From eb91417fc708a1aebad27c0dcdb13b9c6d36daae Mon Sep 17 00:00:00 2001
From: Navid Nikaein <navid.nikaein@eurecom.fr>
Date: Fri, 27 Feb 2015 10:35:37 +0000
Subject: [PATCH] * applying patch 11 contributed from S. Held * add protocol
 configuration to OCG XML file

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6629 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../PHY/LTE_ESTIMATION/lte_sync_timefreq.c    |  2 +-
 openair1/PHY/LTE_TRANSPORT/print_stats.c      |  2 -
 openair1/SCHED/phy_procedures_lte_ue.c        |  3 +-
 openair2/ENB_APP/enb_config.c                 |  2 +-
 openair2/LAYER2/MAC/eNB_scheduler_RA.c        |  2 +-
 openair2/LAYER2/MAC/pre_processor.c           | 13 ++--
 openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c      |  4 +-
 .../RLC/AM_v9.3.0/rlc_am_status_report.c      |  3 +-
 .../LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c     |  4 +-
 openair2/LAYER2/RLC/rlc_rrc.c                 |  2 +-
 openair2/PHY_INTERFACE/defs.h                 |  2 +-
 openair2/RRC/LITE/rrc_UE.c                    |  2 +-
 openair2/RRC/LITE/rrc_eNB.c                   |  2 +-
 openair2/UTIL/LOG/log.c                       |  1 +
 openair2/UTIL/MEM/mem_block.c                 | 52 +++++++-------
 openair2/UTIL/OCG/OCG.h                       | 70 +++++++++++++------
 openair2/UTIL/OCG/OCG_parse_XML.c             | 30 +++++++-
 openair2/UTIL/OPT/probe.c                     |  5 +-
 openair2/UTIL/OTG/otg_kpi.c                   |  3 +-
 openair2/UTIL/OTG/otg_models.c                |  4 +-
 targets/RT/USER/lte-ue.c                      |  6 +-
 targets/SIMU/USER/oaisim_config.c             | 20 ++++--
 targets/build_oai.bash                        |  2 +-
 23 files changed, 151 insertions(+), 85 deletions(-)

diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
index a2d4c91b7..dba4d5d7e 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
@@ -49,7 +49,7 @@
 #include "pss6144.h"
 
 #define DEBUG_TF 1
-extern print_shorts(char*,__m128i*);
+extern void print_shorts(char*,__m128i*);
 
 void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq) {
 
diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c
index 75f111c98..b30c790c2 100644
--- a/openair1/PHY/LTE_TRANSPORT/print_stats.c
+++ b/openair1/PHY/LTE_TRANSPORT/print_stats.c
@@ -508,7 +508,6 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
   }
 
   len += sprintf(&buffer[len],"EOF\n");
-  len += sprintf(&buffer[len],"\0");
 
   return len;
 } // is_clusterhead
@@ -751,7 +750,6 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
     len += sprintf(&buffer[len],"\n");
   }
   len += sprintf(&buffer[len],"EOF\n");
-  len += sprintf(&buffer[len],"\0");
   
   return len;
 }
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index b799c7e62..dd7f3aa7e 100755
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -3640,7 +3640,8 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold
 				  frame_tx,
 				  subframe_rx, 
 				  subframe_select(&phy_vars_ue->lte_frame_parms,subframe_tx),
-				  eNB_id);
+				  eNB_id,
+				  0/*FIXME CC_id*/);
     if (ret == CONNECTION_LOST) {
       LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",phy_vars_ue->Mod_id,
 	    frame_rx,subframe_tx);
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index fbb005312..5a3bb9b17 100755
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -460,7 +460,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
     libconfig_int          tdd_config_s;
     const char*            prefix_type              = NULL;
     libconfig_int          eutra_band;
-    int64_t                downlink_frequency;
+    long long int          downlink_frequency;
     libconfig_int          uplink_frequency_offset;
     libconfig_int          Nid_cell;
     libconfig_int          Nid_cell_mbsfn;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index b4414138f..7ea9bacf3 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -393,7 +393,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
                         DevAssert( UE_id != UE_INDEX_INVALID ); // FIXME not sure how to gracefully return
                         offset = generate_dlsch_header((unsigned char*)eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0],
                                                        1,                           //num_sdus
-                                                       &rrc_sdu_length,             //
+                                                       (unsigned short*)&rrc_sdu_length,             //
                                                        &lcid,                       // sdu_lcid
                                                        255,                         // no drx
                                                        0,                           // no timing advance
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 9d839628f..a8c76b06a 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -450,9 +450,10 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
       else if( (min_rb_unit[CC_id] * total_ue_count) <= (frame_parms[CC_id]->N_RB_DL) )
 	average_rbs_per_user[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/total_ue_count);
       else 
-	average_rbs_per_user[CC_id] = min_rb_unit[CC_id];
+	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]){
@@ -461,14 +462,16 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
       // control channel
       if (mac_get_rrc_status(Mod_id,1,i) < RRC_RECONFIGURED)
 	nb_rbs_required_remaining_1[CC_id][i] = nb_rbs_required[CC_id][i];
-      else
+      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 round: average number of RBs allocated to each UE
-  // 2nd round: remaining RBs are allocated to high priority UEs
+  // 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]) {
@@ -511,7 +514,7 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 	  // retransmission in data channels 
 	  // control channel in the 1st transmission
 	  // data channel for all TM 
-	  LOG_D(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n ");
+	  LOG_T(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n ");
 	  dlsch_scheduler_pre_processor_allocate (Mod_id,
 						  UE_id, 
 						  CC_id,
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index f878e7f0e..2c3642d1a 100755
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -933,7 +933,9 @@ 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++) {
           if (mac_get_rrc_status(ctxt_pP->enb_module_id, ctxt_pP->enb_flag, dst_id ) > 2) {
-              otg_pkt=packet_gen(src_id, dst_id, 0, ctime, &pkt_size);
+              unsigned int temp = 0;
+              otg_pkt = packet_gen( src_id, dst_id, 0, ctime, &temp );
+              pkt_size = temp;
               if (otg_pkt != NULL){
                   rb_id = dst_id * maxDRB + DTCH;
                   ctxt.ue_module_id  = dst_id;
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 2497ed562..6331a236d 100755
--- 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
@@ -416,7 +416,8 @@ rlc_am_write_status_pdu(
           rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 15, pdu_info_pP->nack_list[index].so_end);
       }
   }
-  num_bytes = ((unsigned int)byte_pos_p) - ((unsigned int)(&rlc_am_pdu_sn_10_pP->b1));
+  ptrdiff_t diff = byte_pos_p - &rlc_am_pdu_sn_10_pP->b1; // this is the difference in terms of typeof(byte_pos_p), which is uint8_t
+  num_bytes = diff;
   if (bit_pos > 0) {
       num_bytes += 1;
   }
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 8348b6a50..b0414f294 100755
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
@@ -297,7 +297,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP)
                         sdu_mngt_p->sdu_size);
 #endif
             }
-            data_sdu_p = &(sdu_in_buffer->data[sizeof (struct rlc_um_tx_sdu_management) + sdu_mngt_p->sdu_segmented_size]);
+            data_sdu_p = (char *) &(sdu_in_buffer->data[sizeof (struct rlc_um_tx_sdu_management) + sdu_mngt_p->sdu_segmented_size]);
 
             if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) {
 #if defined(TRACE_RLC_UM_SEGMENT)
@@ -744,7 +744,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP)
                         sdu_mngt_p->sdu_size);
 #endif
             }
-            data_sdu_p = &(sdu_in_buffer->data[sizeof (struct rlc_um_tx_sdu_management) + sdu_mngt_p->sdu_segmented_size]);
+            data_sdu_p = (char*) &(sdu_in_buffer->data[sizeof (struct rlc_um_tx_sdu_management) + sdu_mngt_p->sdu_segmented_size]);
 
             if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) {
 #if defined(TRACE_RLC_UM_SEGMENT)
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index 3745cbd9c..116a2a01e 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -522,7 +522,7 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
 
     AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
 
-    h_rc = hashtable_get(rlc_coll_p, key, &rlc_union_p);
+    h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
     if (h_rc == HASH_TABLE_OK) {
         h_rc = hashtable_remove(rlc_coll_p, key);
         LOG_D(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASED %s\n",
diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h
index 5223c64a7..ad9884824 100755
--- a/openair2/PHY_INTERFACE/defs.h
+++ b/openair2/PHY_INTERFACE/defs.h
@@ -174,7 +174,7 @@ typedef struct
     void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync);
 
     /// Only calls the PDCP for now
-    UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t frameP,sub_frame_t subframe, lte_subframe_t direction,uint8_t eNB_id);
+    UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t frameP,sub_frame_t subframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
 
     /// PHY-Config-Dedicated UE
     void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index 060a13018..a2fcc3c62 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -3265,7 +3265,7 @@ void
                 switch (rrc_get_state(ue_mod_id)) {
                 case RRC_STATE_IDLE:
                   {
-                    if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE)
+                    if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) {
                         rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING);
                       }
                     break;
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index 085687e1b..d526776b0 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -2849,7 +2849,7 @@ int rrc_eNB_decode_ccch(
     SRB_INFO * Srb_info) {
   /*------------------------------------------------------------------------------*/
 
-    module_id_t                         Idx, ue_mod_id;
+    module_id_t                         Idx, ue_mod_id = 0;
     asn_dec_rval_t                      dec_rval;
     UL_CCCH_Message_t                  *ul_ccch_msg = NULL;
     RRCConnectionRequest_r8_IEs_t      *rrcConnectionRequest;
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
index 88d63eeb3..7d46648e4 100755
--- a/openair2/UTIL/LOG/log.c
+++ b/openair2/UTIL/LOG/log.c
@@ -487,6 +487,7 @@ void logRecord(const char *file, const char *func, int line,  int comp,
         log_list_nb_elements++;
     }
     if(pthread_cond_signal(&log_notify) != 0) {
+        pthread_mutex_unlock(&log_lock);
         return;
     }
 
diff --git a/openair2/UTIL/MEM/mem_block.c b/openair2/UTIL/MEM/mem_block.c
index cf9af86ca..f7988a34e 100644
--- a/openair2/UTIL/MEM/mem_block.c
+++ b/openair2/UTIL/MEM/mem_block.c
@@ -82,43 +82,43 @@ pool_buffer_init ()
       //memory->mem_blocks[mb_index + index].next     = NULL; -> done in memset 0
       switch (pool_index) {
           case 0:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool0[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool0[index][0]);
             break;
           case 1:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool1[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool1[index][0]);
             break;
           case 2:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool2[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool2[index][0]);
             break;
           case 3:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool3[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool3[index][0]);
             break;
           case 4:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool4[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool4[index][0]);
             break;
           case 5:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool5[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool5[index][0]);
             break;
           case 6:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool6[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool6[index][0]);
             break;
           case 7:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool7[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool7[index][0]);
             break;
           case 8:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool8[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool8[index][0]);
             break;
           case 9:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool9[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool9[index][0]);
             break;
           case 10:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool10[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool10[index][0]);
             break;
           case 11:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool11[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool11[index][0]);
             break;
           case 12:
-            memory->mem_blocks[mb_index + index].data = &(memory->mem_pool12[index][0]);
+            memory->mem_blocks[mb_index + index].data = (unsigned char*)&(memory->mem_pool12[index][0]);
             break;
           default:;
             memory->mem_blocks[mb_index + index].data = NULL;   // pool copy
@@ -300,79 +300,79 @@ check_mem_area (void)
   mem_pool       *memory = (mem_pool *) &mem_block_var;
 
   for (index = 0; index < MEM_MNGT_MB0_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[index].data != &(memory->mem_pool0[index][0])) && (memory->mem_blocks[index].pool_id != MEM_MNGT_POOL_ID0)) {
+    if ((memory->mem_blocks[index].data != (unsigned char*)&(memory->mem_pool0[index][0])) && (memory->mem_blocks[index].pool_id != MEM_MNGT_POOL_ID0)) {
       msg ("[MEM] ERROR POOL0 block index %d\n", index);
     }
   }
   mb_index = MEM_MNGT_MB0_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB1_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool1[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID1)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool1[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID1)) {
       msg ("[MEM] ERROR POOL1 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB1_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB2_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool2[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID2)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool2[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID2)) {
       msg ("[MEM] ERROR POOL2 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB2_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB3_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool3[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID3)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool3[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID3)) {
       msg ("[MEM] ERROR POOL3 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB3_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB4_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool4[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID4)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool4[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID4)) {
       msg ("[MEM] ERROR POOL4 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB4_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB5_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool5[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID5)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool5[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID5)) {
       msg ("[MEM] ERROR POOL5 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB5_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB6_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool6[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID6)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool6[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID6)) {
       msg ("[MEM] ERROR POOL6 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB6_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB7_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool7[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID7)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool7[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID7)) {
       msg ("[MEM] ERROR POOL7 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB7_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB8_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool8[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID8)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool8[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID8)) {
       msg ("[MEM] ERROR POOL8 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB8_NB_BLOCKS;
   for (index = 0; index < MEM_MNGT_MB9_NB_BLOCKS; index++) {
-    if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool9[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID9)) {
+    if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool9[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID9)) {
       msg ("[MEM] ERROR POOL9 block index %d\n", index);
     }
   }
   mb_index += MEM_MNGT_MB9_NB_BLOCKS;
   for (index = mb_index; index < MEM_MNGT_MB10_NB_BLOCKS; index++) {
-	  if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool10[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID10)) {
+      if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool10[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID10)) {
 		  msg ("[MEM] ERROR POOL10 block index %d\n", index);
 	  }
   }
   mb_index += MEM_MNGT_MB10_NB_BLOCKS;
   for (index = mb_index; index < MEM_MNGT_MB11_NB_BLOCKS; index++) {
-	  if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool11[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID11)) {
+      if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool11[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID11)) {
 		  msg ("[MEM] ERROR POOL11 block index %d\n", index);
 	  }
   }
   mb_index += MEM_MNGT_MB11_NB_BLOCKS;
   for (index = mb_index; index < MEM_MNGT_MB12_NB_BLOCKS; index++) {
-	  if ((memory->mem_blocks[mb_index + index].data != &(memory->mem_pool12[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID12)) {
+      if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool12[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID12)) {
 		  msg ("[MEM] ERROR POOL12 block index %d\n", index);
 	  }
   }
diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h
index 3b1b0e03b..431beed61 100644
--- a/openair2/UTIL/OCG/OCG.h
+++ b/openair2/UTIL/OCG/OCG.h
@@ -467,28 +467,33 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
 
   typedef struct
   {
-	uint16_t priority[11];//pas possible d'acceder au MAX_NUM_LCID
-	//
-	uint8_t DCI_aggregation_min;
-	uint8_t DLSCH_dci_size_bits;
-	//UL transmission bandwidth in RBs
-	uint8_t ul_bandwidth[11];
-	//DL transmission bandwidth in RBs
-	uint8_t dl_bandwidth[11];
-	//UL transmission bandwidth in RBs
-	uint8_t min_ul_bandwidth[11];
-	//DL transmission bandwidth in RBs
-	uint8_t min_dl_bandwidth[11];
-	//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[11];
-	uint8_t max_mcs[11];	
+    uint16_t priority[11];//pas possible d'acceder au MAX_NUM_LCID
+    //
+    uint8_t DCI_aggregation_min;
+    uint8_t DLSCH_dci_size_bits;
+    //UL transmission bandwidth in RBs
+    uint8_t ul_bandwidth[11];
+    //DL transmission bandwidth in RBs
+    uint8_t dl_bandwidth[11];
+    //UL transmission bandwidth in RBs
+    uint8_t min_ul_bandwidth[11];
+    //DL transmission bandwidth in RBs
+    uint8_t min_dl_bandwidth[11];
+    //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[11];
+    uint8_t max_mcs[11];	
+    
+    
+    uint8_t num_groups;	
+    
+    
   } Mac_config;
 
 /** @defgroup _Predefined_traffic Configuration
@@ -653,6 +658,24 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
   } Emulation_Config;
 /* @}*/
 
+/** @defgroup  _OSD_basic OAI protocol config
+ *  @ingroup _OCG
+ *  @brief OAI Emulation struct for protocol configuration 
+ * @{*/
+
+  typedef struct{
+    uint8_t num_groups; 
+  } eNB_MAC_Config;
+  
+  typedef struct
+  {
+    eNB_MAC_Config eNB_mac_config; 	/*!< \brief eNB MAC configuration parameters  */
+    
+  } Protocol_Config;
+
+
+/* @}*/
+
 /** @defgroup  _OSD_basic Basic OpenAirInterface Scenario Descriptor
  *  @ingroup _OCG
  *  @brief OAI Emulation struct for OSD_basic
@@ -762,11 +785,12 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
  * @{*/
   typedef struct
   {
-    		Mac_config mac_config[NUMBER_OF_UE_MAX];		
+    Mac_config mac_config[NUMBER_OF_UE_MAX];		
     Environment_System_Config environment_system_config;	/*!< \brief Evironment configuration */
     Topology_Config topology_config;	/*!< \brief Topology configuration */
     Application_Config application_config;	/*!< \brief Applications configuration */
     Emulation_Config emulation_config;	/*!< \brief Emulation configuration */
+    Protocol_Config protocol_config;  /* specific protocol configuration*/
     Info info;			/*!< \brief Some important information which should be able to be reached by OAISIM */
     char *profile;
   } OAI_Emulation;
diff --git a/openair2/UTIL/OCG/OCG_parse_XML.c b/openair2/UTIL/OCG/OCG_parse_XML.c
index ee43265ed..67cf05ae5 100644
--- a/openair2/UTIL/OCG/OCG_parse_XML.c
+++ b/openair2/UTIL/OCG/OCG_parse_XML.c
@@ -199,6 +199,11 @@ static int emu_;
 static int omg_;
 static int otg_;
 
+/* MAC*/
+static int protocol_;
+static int mac_;
+static int num_groups_;
+
 static int log_;
 static int level_;
 static int verbosity_;
@@ -572,7 +577,14 @@ void start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
 	} else if (!xmlStrcmp(name,(unsigned char*) "START_UE")) {
 		cli_start_ue_ = 1;
 
-	} else if (!xmlStrcmp(name,(unsigned char*) "PROFILE")) {
+	} else if (!xmlStrcmp(name,(unsigned char*) "PROTOCOL")) {
+	  protocol_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "MAC")) {
+	  mac_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "NUM_GROUPS")) {
+	  num_groups_ = 1;
+	}
+	else if (!xmlStrcmp(name,(unsigned char*) "PROFILE")) {
 		profile_ = 1;
 	} else {
 		LOG_W(OCG, "One element could not be parsed : unknown element name '%s'\n", name);
@@ -905,6 +917,12 @@ void end_element(void *user_data, const xmlChar *name) { // called once at the e
 		cli_start_enb_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "START_UE")) {
 		cli_start_ue_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "PROTOCOL")) {
+	  protocol_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "MAC")) {
+	  mac_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "NUM_GROUPS")) {
+	  num_groups_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "PROFILE")) {
 		profile_ = 0;
 	}
@@ -1312,7 +1330,15 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
 			oai_emulation.info.cli_start_ue[i] =  atoi(ch);
 		    }
 		  }
-		} else if (profile_) {
+		} 
+		else if (protocol_) {
+		  if (mac_){
+		    if (num_groups_){
+		      oai_emulation.protocol_config.eNB_mac_config.num_groups=atoi(ch);
+		    }
+		  }
+		}
+		else if (profile_) {
 		  oai_emulation.profile = strndup(ch, len);
 		}
 	}	
diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c
index e3a631ac8..38fcaac38 100644
--- a/openair2/UTIL/OPT/probe.c
+++ b/openair2/UTIL/OPT/probe.c
@@ -498,13 +498,14 @@ int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p)
     subframesSinceCaptureStart = 0;
 
     if (path != NULL) {
-        strncpy( in_path, sizeof(in_path), path );
+        strncpy( in_path, path, sizeof(in_path) );
         in_path[sizeof(in_path) - 1] = 0; // terminate string
     } else {
         strcpy( in_path, "oai_opt.pcap" );
     }
     if (ip != NULL) {
-        strncpy( in_ip, sizeof(in_ip), ip );
+        strncpy( in_ip, ip, sizeof(in_ip) );
+        in_ip[sizeof(in_ip) - 1] = 0; // terminate string
     } else {
         strcpy( in_ip, "127.0.0.1" );
     }
diff --git a/openair2/UTIL/OTG/otg_kpi.c b/openair2/UTIL/OTG/otg_kpi.c
index e93bd8c35..b4964ad0a 100644
--- a/openair2/UTIL/OTG/otg_kpi.c
+++ b/openair2/UTIL/OTG/otg_kpi.c
@@ -390,11 +390,10 @@ fc=fopen("/tmp/otg.log","w");;
 	  else
 	    strcpy(traffic_type,"APPLICATION");
 	  
-	  if (map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]) == -1){
+      if (map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]) == 0){
 	    LOG_E(OTG,"(src=%d, dst=%d, appli %d) : Unknown traffic \n ", i, j,k);
 	  strcpy(traffic,"UKNOWN TRAFFIC"); 	   
 	  } else {
-	    //strcpy (traffic, map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]));
 	    strncpy (traffic, map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]), sizeof(traffic));
 	    traffic[sizeof(traffic) - 1] = 0; // terminate string
 	  }
diff --git a/openair2/UTIL/OTG/otg_models.c b/openair2/UTIL/OTG/otg_models.c
index 379cc04f9..50e462747 100644
--- a/openair2/UTIL/OTG/otg_models.c
+++ b/openair2/UTIL/OTG/otg_models.c
@@ -431,7 +431,7 @@ void tarmaPrintVideoInit(tarmaVideo_t *video){
  input:		
  output: 	- random realization of R_s (B/s)
  */
-double backgroundRateRnd(){
+double backgroundRateRnd(void){
   double rate;
   rate=pow(10,lognormal_dist(1.3525, 0.1954))/8; /*Byte/s*/;
   if(rate>BACKGROUND_RATE_MAX){ 
@@ -447,7 +447,7 @@ double backgroundRateRnd(){
  input:		
  output: 	- random realization of D_s (ms)
  */
-int backgroundSessionDurationRnd(){
+int backgroundSessionDurationRnd(void){
   int duration;
   duration = ceil(pow(10,exponential_dist(1/0.3591))*1000); /*ms*/
   if(duration<0){
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index dddd24563..444a98e54 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -575,7 +575,8 @@ static void *UE_thread_tx(void *arg) {
 				    UE->frame_tx,
 				    UE->slot_rx>>1, 
 				    subframe_select(&UE->lte_frame_parms,UE->slot_tx>>1),
-				    0);
+                    0,
+                    0/*FIXME CC_id*/);
       
       if (ret == CONNECTION_LOST) {
 	LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",UE->Mod_id,
@@ -711,7 +712,8 @@ static void *UE_thread_rx(void *arg) {
 					UE->frame_tx,
 					UE->slot_rx>>1,
 					subframe_select(&UE->lte_frame_parms,UE->slot_tx>>1),
-					0);
+                    0,
+                    0/*FIXME CC_id*/);
 	  
 	  if (ret == CONNECTION_LOST) {
 	    LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",UE->Mod_id,
diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c
index 5d521dd64..47af195f9 100644
--- a/targets/SIMU/USER/oaisim_config.c
+++ b/targets/SIMU/USER/oaisim_config.c
@@ -209,7 +209,8 @@ void init_oai_emulation(void) {
     oai_emulation.application_config.customized_traffic.ed_size_pkts[i]= 0;
   }
   
-  
+  /* protocol config */
+  oai_emulation.protocol_config.eNB_mac_config.num_groups=1;
   
   
   oai_emulation.emulation_config.emulation_time_ms = 0;
@@ -354,7 +355,8 @@ void oaisim_config(void) {
   ocg_config_emu();
   ocg_config_env();// mobility gen
   ocg_config_topo(); // packet tracer using wireshark
- 	// if T is set or ocg enabled
+  ocg_config_proto();
+  // if T is set or ocg enabled
   if (oai_emulation.info.otg_enabled ) {
     set_component_filelog(OTG);
     set_component_filelog(OTG_LATENCY);
@@ -367,10 +369,10 @@ void oaisim_config(void) {
     g_log->log_component[OTG_OWD].filelog = 1;*/
     ocg_config_app(); // packet generator
   }
-	// add a var to control this, and pass this var to OMG
-	set_component_filelog(OMG);
-	LOG_I(OMG,"setting OMG file log \n");
-
+  // add a var to control this, and pass this var to OMG
+  set_component_filelog(OMG);
+  LOG_I(OMG,"setting OMG file log \n");
+  
 }
 
 int olg_config(void) {
@@ -1180,3 +1182,9 @@ int ocg_config_emu(void){
   return 1;
 }
 
+void  ocg_config_proto(void){
+  
+  LOG_I(MAC,"num groups is set to %d\n",oai_emulation.protocol_config.eNB_mac_config.num_groups);
+
+}
+
diff --git a/targets/build_oai.bash b/targets/build_oai.bash
index 37ca00f77..c34e91321 100755
--- a/targets/build_oai.bash
+++ b/targets/build_oai.bash
@@ -49,7 +49,7 @@ declare OAI_DB_ADMIN_USER_NAME="root"
 declare OAI_DB_ADMIN_USER_PASSWORD="linux"
 
 #only one could be set at the time
-declare BUILD_LTE="ENB" # ENB, EPC, HSS
+declare BUILD_LTE="NONE" # ENB, EPC, HSS
 
 declare HW="EXMIMO" # EXMIMO, USRP, ETHERNET, NONE
 declare TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE
-- 
GitLab