From 8b7143022b7b922fc38c3ea7a9282f4dd01a72e7 Mon Sep 17 00:00:00 2001
From: Navid Nikaein <navid.nikaein@eurecom.fr>
Date: Fri, 2 May 2014 08:38:08 +0000
Subject: [PATCH] * manage control elements in CCCH PDU through rx_sdu function
 * add event handler for remote (online) configuration and status monitoring *
 update openair config generator (OCG) and scneario descriptor (OSD) with new
 features contributed by A. Gomes (one source) * fix the issue with netlink
 when benchmarking oaisim preformance * pre-ci passed except for eMBMS

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5299 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair1/SCHED/phy_procedures_lte_common.c    |   2 +-
 openair1/SCHED/phy_procedures_lte_eNb.c       |   7 +
 openair1/SIMULATION/TOOLS/abstraction.c       |   2 +-
 openair2/COMMON/platform_constants.h          |   6 +-
 openair2/COMMON/platform_types.h              |   2 +-
 openair2/LAYER2/MAC/defs.h                    |   2 +-
 openair2/LAYER2/MAC/eNB_scheduler.c           | 266 +++++++++++-------
 openair2/PHY_INTERFACE/defs.h                 |  18 +-
 openair2/RRC/LITE/defs.h                      |   6 +
 openair2/RRC/LITE/rrc_common.c                |   3 +-
 openair2/RRC/LITE/rrc_eNB.c                   |  77 ++++-
 openair2/UTIL/CLI/cli.h                       |  17 +-
 openair2/UTIL/FIFO/pad_list.c                 |  44 ++-
 openair2/UTIL/FIFO/pad_list.h                 |  38 ++-
 openair2/UTIL/FIFO/types.h                    |  59 +++-
 openair2/UTIL/OCG/OCG.h                       |  13 +-
 openair2/UTIL/OCG/OCG_parse_XML.c             |  87 +++++-
 openair2/UTIL/OMG/common.c                    |  11 +-
 openair2/UTIL/OMG/defs.h                      |  18 +-
 openair2/UTIL/OMG/static.c                    |  33 ++-
 openair2/UTIL/OSD/form.php                    |  37 ++-
 openair2/UTIL/OSD/header.php                  |  49 ++--
 openair2/UTIL/OSD/recep.php                   | 226 ++++++++++++---
 openair2/UTIL/OTG/otg_kpi.c                   |   2 +-
 .../GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf     |   2 +-
 .../SIMU/EXAMPLES/OSD/WEBXML/template_13.xml  |   2 +-
 targets/SIMU/USER/Makefile                    |   1 +
 targets/SIMU/USER/discrete_event_generator.h  |  14 -
 ...rete_event_generator.c => event_handler.c} | 228 ++++++++++++---
 targets/SIMU/USER/event_handler.h             |  67 +++++
 targets/SIMU/USER/oaisim.c                    |  40 ++-
 targets/SIMU/USER/oaisim.h                    |   9 +-
 targets/SIMU/USER/oaisim_config.c             |  66 ++++-
 targets/SIMU/USER/oaisim_config.h             |  21 +-
 targets/SIMU/USER/oaisim_functions.c          |  54 +++-
 35 files changed, 1171 insertions(+), 358 deletions(-)
 delete mode 100644 targets/SIMU/USER/discrete_event_generator.h
 rename targets/SIMU/USER/{discrete_event_generator.c => event_handler.c} (81%)
 create mode 100644 targets/SIMU/USER/event_handler.h

diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c
index 23215ba6a9..c9683b854f 100755
--- a/openair1/SCHED/phy_procedures_lte_common.c
+++ b/openair1/SCHED/phy_procedures_lte_common.c
@@ -332,7 +332,7 @@ uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,
       subframe_dl = subframe - 4;
     o_ACK[0] = harq_ack[subframe_dl].ack;
     status = harq_ack[subframe_dl].send_harq_status;
-    printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]);
+    //printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]);
   }
   else {
     switch (frame_parms->tdd_config) {
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index d090146455..7572c1f3ac 100755
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -3093,11 +3093,18 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui
 		phy_vars_eNB->Mod_id,
 		frame,harq_pid,i);
 #endif
+	  mac_xface->rx_sdu(phy_vars_eNB->Mod_id,
+			    frame,
+			    phy_vars_eNB->ulsch_eNB[i]->rnti,
+			    phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
+			    phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3);
+	  /*
 	  mac_xface->terminate_ra_proc(phy_vars_eNB->Mod_id,
 				       frame,
 				       phy_vars_eNB->ulsch_eNB[i]->rnti,
 				       phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
 				       phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3);
+	  */
 #endif
 
 	  phy_vars_eNB->eNB_UE_stats[i].mode = PUSCH;
diff --git a/openair1/SIMULATION/TOOLS/abstraction.c b/openair1/SIMULATION/TOOLS/abstraction.c
index 4eba0423f5..ac9584f2cd 100644
--- a/openair1/SIMULATION/TOOLS/abstraction.c
+++ b/openair1/SIMULATION/TOOLS/abstraction.c
@@ -241,7 +241,7 @@ double pbch_bler(double sinr) {
     }
     bler = pow(10.0,log10_bler);
   }
-  printf ("sinr %f bler %f\n",sinr,bler);
+  //printf ("sinr %f bler %f\n",sinr,bler);
   return(bler);
 
 }
diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h
index 107b84ca83..2facade07a 100755
--- a/openair2/COMMON/platform_constants.h
+++ b/openair2/COMMON/platform_constants.h
@@ -12,7 +12,11 @@
 #ifndef __PLATFORM_CONSTANTS_H__
 #    define __PLATFORM_CONSTANTS_H__
 
-#define NL_MAX_PAYLOAD 4096  /* this should cover the max mtu size*/
+#ifdef JUMBO_FRAME
+       #define NL_MAX_PAYLOAD 18000  /* this should cover the max mtu size*/
+#else
+       #define NL_MAX_PAYLOAD 9000  /* this should cover the max mtu size*/
+#endif
 
 #ifdef USER_MODE
 #ifdef LARGE_SCALE
diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h
index 8551e75af2..c23fe3d803 100755
--- a/openair2/COMMON/platform_types.h
+++ b/openair2/COMMON/platform_types.h
@@ -36,7 +36,7 @@ typedef uint32_t              frame_t;
 typedef int32_t               sframe_t;
 typedef uint32_t              sub_frame_t;
 typedef uint8_t               module_id_t;
-typedef int8_t                smodule_id_t;
+typedef int16_t                smodule_id_t;
 typedef uint16_t              rb_id_t;
 typedef uint16_t              srb_id_t;
 
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index 7acd9ed712..a3b07dae45 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -1069,7 +1069,7 @@ can be scheduled.
 @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, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframe);//, int calibration_flag);
+void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
 
 /* \brief Function to retrieve result of scheduling (DCI) in current subframe.  Can be called an arbitrary numeber of times after eNB_dlsch_ulsch_scheduler
 in a given subframe.
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index e54a630d85..e8af7ba006 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -436,12 +436,11 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP, frame_t frameP, rnti_t rnti
 
       return((unsigned char *)&eNB_mac_inst[module_idP].BCCH_pdu.payload[0]);
   }
-  else {
-
-      ue_mod_id = find_UE_id(module_idP,rntiP);
-      LOG_D(MAC,"[eNB %d] Frame %d  Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,rntiP,ue_mod_id);
-
-      return((unsigned char *)&eNB_mac_inst[module_idP].DLSCH_pdu[ue_mod_id][TBindex].payload[0]);
+  else if ((ue_mod_id = find_UE_id(module_idP,rntiP)) != UE_INDEX_INVALID ){
+    LOG_D(MAC,"[eNB %d] Frame %d:  Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,rntiP,ue_mod_id);
+    return((unsigned char *)&eNB_mac_inst[module_idP].DLSCH_pdu[ue_mod_id][TBindex].payload[0]);
+  } else {
+    LOG_E(MAC,"[eNB %d] Frame %d: UE with RNTI %x does not exist\n", module_idP,frameP,rntiP);
   }
 
 }
@@ -516,9 +515,9 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
 
 void SR_indication(module_id_t enb_mod_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP) {
 
-  smodule_id_t ue_mod_id = find_UE_id(enb_mod_idP, rntiP);
+  module_id_t ue_mod_id = find_UE_id(enb_mod_idP, rntiP);
   
-  if (ue_mod_id >= 0) {
+  if (ue_mod_id  != UE_INDEX_INVALID ) {
       LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d \n",enb_mod_idP,rntiP,frameP,subframeP, ue_mod_id);
       eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_SR = 1;
       eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_active = TRUE;
@@ -533,128 +532,185 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,uint8_t *sdu, ui
   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];
-  module_id_t         ue_mod_id = find_UE_id(enb_mod_idP,rntiP);
+  module_id_t    ue_mod_id = find_UE_id(enb_mod_idP,rntiP);
   int ii,j;
   start_meas(&eNB_mac_inst[enb_mod_idP].rx_ulsch_sdu);
-
+  
+  if ((ue_mod_id >  NUMBER_OF_UE_MAX) || (ue_mod_id == -1) || (ue_mod_id == 255) )
+  
   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);
 
-  eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_pdu_bytes_rx+=sdu_len;
-  eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_num_pdus_rx+=1;
-
   LOG_D(MAC,"[eNB %d] Received ULSCH sdu from PHY (rnti %x, UE_id %d), parsing header\n",enb_mod_idP,rntiP,ue_mod_id);
   payload_ptr = parse_ulsch_header(sdu,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,sdu_len);
 
   // control element
   for (i=0;i<num_ce;i++) {
 
-      switch (rx_ces[i]) { // implement and process BSR + CRNTI +
-      case POWER_HEADROOM:
-        eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info =  (payload_ptr[0] & 0x3f);// - PHR_MAPPING_OFFSET;
-        LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info);
-        payload_ptr+=sizeof(POWER_HEADROOM_CMD);
-        break;
+    switch (rx_ces[i]) { // implement and process BSR + CRNTI +
+    case POWER_HEADROOM:
+      if (ue_mod_id != UE_INDEX_INVALID ){
+	eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info =  (payload_ptr[0] & 0x3f);// - PHR_MAPPING_OFFSET;
+	LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info);
+      }
+      payload_ptr+=sizeof(POWER_HEADROOM_CMD);
+      break;
       case CRNTI:
         LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received CRNTI %d \n", rx_ces[i], payload_ptr[0]);
         payload_ptr+=1;
         break;
-      case TRUNCATED_BSR:
-      case SHORT_BSR: {
-        uint8_t lcgid;
-
-        lcgid = (payload_ptr[0] >> 6);
-        LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
-            rx_ces[i], lcgid, payload_ptr[0] & 0x3f);
-        eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[lcgid] = (payload_ptr[0] & 0x3f);
-        payload_ptr += 1;//sizeof(SHORT_BSR); // fixme
-      } break;
-      case LONG_BSR:
-        eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2);
-        eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1] =
-            ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
-        eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2] =
-            ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
-        eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3] = (payload_ptr[2] & 0x3F);
-        LOG_D(MAC, "[eNB] MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = "
-            "%u LCGID2 = %u LCGID3 = %u\n",
-            rx_ces[i],
-            eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0],
-            eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1],
-            eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2],
-            eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3]);
-        payload_ptr += 3;////sizeof(LONG_BSR);
-        break;
-      default:
-        LOG_E(MAC, "[eNB] Received unknown MAC header (0x%02x)\n", rx_ces[i]);
-        break;
+    case TRUNCATED_BSR:
+    case SHORT_BSR: {
+      if (ue_mod_id  != UE_INDEX_INVALID ){
+	uint8_t lcgid;
+	lcgid = (payload_ptr[0] >> 6);
+	LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
+	      rx_ces[i], lcgid, payload_ptr[0] & 0x3f);
+	eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[lcgid] = (payload_ptr[0] & 0x3f);
+      }
+      payload_ptr += 1;//sizeof(SHORT_BSR); // fixme
+    } break;
+    case LONG_BSR:
+      if (ue_mod_id  != UE_INDEX_INVALID ){
+	eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2);
+	eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1] =
+	  ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
+	eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2] =
+	  ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
+	eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3] = (payload_ptr[2] & 0x3F);
+	LOG_D(MAC, "[eNB] MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = "
+	      "%u LCGID2 = %u LCGID3 = %u\n",
+	      rx_ces[i],
+	      eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0],
+	      eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1],
+	      eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2],
+	      eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3]);
       }
+      payload_ptr += 3;////sizeof(LONG_BSR);
+      break;
+    default:
+      LOG_E(MAC, "[eNB] Received unknown MAC header (0x%02x)\n", 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]);
-
-      if ((rx_lcids[i] == DCCH)||(rx_lcids[i] == DCCH1)) {
-          //      if(eNB_mac_inst[module_idP].Dcch_lchan[UE_id].Active==1){
-
+    LOG_D(MAC,"SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
+    
+    switch (rx_lcids[i]) {
+    case CCCH : 
+      LOG_I(MAC,"[eNB %d][RAPROC] Frame %d, Received CCCH:  %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n",
+	    enb_mod_idP,frameP,
+	    payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4], payload_ptr[5], rntiP);
+
+      for (ii=0;ii<NB_RA_PROC_MAX;ii++) {
+	LOG_D(MAC,"[RAPROC] Checking proc %d : rnti (%x, %x), active %d\n",ii,
+	      eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti, rntiP,
+	      eNB_mac_inst[enb_mod_idP].RA_template[ii].RA_active);
+	
+	if ((eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti==rntiP) &&
+	    (eNB_mac_inst[enb_mod_idP].RA_template[ii].RA_active==TRUE)) {
+	  
+          //payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
+	  
+	  if (ue_mod_id == UE_INDEX_INVALID) {
+	    memcpy(&eNB_mac_inst[enb_mod_idP].RA_template[ii].cont_res_id[0],payload_ptr,6);
+	    LOG_I(MAC,"[eNB %d][RAPROC] Frame %d CCCH: Received RRCConnectionRequest: length %d, offset %d\n",
+                  enb_mod_idP,frameP,rx_lengths[ii],payload_ptr-sdu);
+	    if ((ue_mod_id=add_new_ue(enb_mod_idP,eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti)) == -1 )
+	      mac_xface->macphy_exit("[MAC][eNB] Max user count reached\n");
+	    else 
+	      LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Added user with rnti %x => UE %d\n",
+		    enb_mod_idP,frameP,eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti,ue_mod_id);
+	  } else {
+	     LOG_I(MAC,"[eNB %d][RAPROC] Frame %d CCCH: Received RRCConnectionReestablishment from UE %d: length %d, offset %d\n",
+		   enb_mod_idP,frameP,ue_mod_id,rx_lengths[ii],payload_ptr-sdu);
+	  }
+	  
+	  if (Is_rrc_registered == 1)
+	    mac_rrc_data_ind(enb_mod_idP,frameP,CCCH,(uint8_t *)payload_ptr,rx_lengths[ii],1,enb_mod_idP,0);
+	  
+	  
+          if (num_ce >0) {  // handle msg3 which is not RRCConnectionRequest
+	    //	process_ra_message(msg3,num_ce,rx_lcids,rx_ces);
+	  }
+	  
+	  eNB_mac_inst[enb_mod_idP].RA_template[ii].generate_Msg4 = 1;
+	  eNB_mac_inst[enb_mod_idP].RA_template[ii].wait_ack_Msg4 = 0;
+	  
+	  
+	} // if process is active
+	
+      } // loop on RA processes
+      
+      break;
+    case  DCCH : 
+    case DCCH1 :
+      //      if(eNB_mac_inst[module_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-sdu));
-          for (j=0;j<32;j++)
-            LOG_T(MAC,"%x ",payload_ptr[j]);
-          LOG_T(MAC,"\n");
+      LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sdu));
+      for (j=0;j<32;j++)
+	LOG_T(MAC,"%x ",payload_ptr[j]);
+      LOG_T(MAC,"\n");
 #endif
-
-          //  This check is just to make sure we didn't get a bogus SDU length, to be removed ...
-          if (rx_lengths[i]<CCCH_PAYLOAD_SIZE_MAX) {
-              LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d(%d) \n",
-                  enb_mod_idP,frameP, rx_lengths[i], ue_mod_id, rx_lcids[i], rx_lcids[i]);
-
-              mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
-                  rx_lcids[i],
-                  (char *)payload_ptr,
-                  rx_lengths[i],
-                  1,
-                  NULL);//(unsigned int*)crc_status);
-              eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
-              eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
-
-          }
-          //      }
-      } else if (rx_lcids[i] >= DTCH) {
-          //      if(eNB_mac_inst[module_idP].Dcch_lchan[UE_id].Active==1){
-
+      
+      //  This check is just to make sure we didn't get a bogus SDU length, to be removed ...
+      if (rx_lengths[i]<CCCH_PAYLOAD_SIZE_MAX) {
+	LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d(%d) \n",
+	      enb_mod_idP,frameP, rx_lengths[i], ue_mod_id, rx_lcids[i], rx_lcids[i]);
+	
+	mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
+			 rx_lcids[i],
+			 (char *)payload_ptr,
+			 rx_lengths[i],
+			 1,
+			 NULL);//(unsigned int*)crc_status);
+	eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
+	eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
+	
+      }
+      //      }
+      break;
+    case DTCH: // default DRB 
+      //      if(eNB_mac_inst[module_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-sdu));
-
-          for (j=0;j<32;j++)
-            LOG_T(MAC,"%x ",payload_ptr[j]);
-          LOG_T(MAC,"\n");
+      LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sdu));
+      for (j=0;j<32;j++)
+	LOG_T(MAC,"%x ",payload_ptr[j]);
+      LOG_T(MAC,"\n");
 #endif
-
-          LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d (%d)\n",
-              enb_mod_idP,frameP, rx_lengths[i], ue_mod_id,rx_lcids[i],rx_lcids[i]);
-
-          if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) &&  (rx_lengths[i] > 0) ) {   // MAX SIZE OF transport block
-              mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
-                  DTCH,
-                  (char *)payload_ptr,
-                  rx_lengths[i],
-                  1,
-                  NULL);//(unsigned int*)crc_status);
-              eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
-              eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
-
-          }
-          //      }
-      } else {
-          eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_errors_rx+=1;
-          LOG_E(MAC,"[eNB %d] received unknown LCID %d from UE %d ", rx_lcids[i], ue_mod_id);
+      
+      LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d (%d)\n",
+	    enb_mod_idP,frameP, rx_lengths[i], ue_mod_id,rx_lcids[i],rx_lcids[i]);
+      
+      if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) &&  (rx_lengths[i] > 0) ) {   // MAX SIZE OF transport block
+	mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
+			 DTCH,
+			 (char *)payload_ptr,
+			   rx_lengths[i],
+			 1,
+			 NULL);//(unsigned int*)crc_status);
+	eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
+	eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
+	  
       }
-
-      payload_ptr+=rx_lengths[i];
+	//      }
+      break;
+    default :  //if (rx_lcids[i] >= DTCH) {
+      eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_errors_rx+=1;
+      LOG_E(MAC,"[eNB %d] received unsupported or unknown LCID %d from UE %d ", rx_lcids[i], ue_mod_id);
+      break;
+    }
+    payload_ptr+=rx_lengths[i];
+    
   }
 
+  eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_pdu_bytes_rx+=sdu_len;
+  eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_num_pdus_rx+=1;
+  
   vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,0);
   stop_meas(&eNB_mac_inst[enb_mod_idP].rx_ulsch_sdu);
 }
@@ -1625,7 +1681,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
   unsigned char i;//,harq_pid,round;
   uint16_t rrc_sdu_length;
   unsigned char lcid,offset;
-  int8_t UE_id;
+  module_id_t UE_id= UE_INDEX_INVALID;
   unsigned short TBsize = -1;
   unsigned short msg4_padding,msg4_post_padding,msg4_header;
 
diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h
index ec20694277..645fc86744 100755
--- a/openair2/PHY_INTERFACE/defs.h
+++ b/openair2/PHY_INTERFACE/defs.h
@@ -69,7 +69,7 @@ typedef struct
 
     // eNB functions
     /// Invoke dlsch/ulsch scheduling procedure for new subframe
-    void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id, uint8_t cooperation_flag, frame_t frameP, uint8_t subframe);//, int calibration_flag);
+    void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
 
     /// Fill random access response sdu, passing timing advance
     uint16_t (*fill_rar)(module_id_t Mod_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t N_RB_UL, uint8_t input_buffer_length);
@@ -84,7 +84,7 @@ typedef struct
     void (*cancel_ra_proc)(module_id_t Mod_id,frame_t frameP,uint16_t preamble);
 
     /// Get DCI for current subframe from MAC
-    DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,frame_t frameP,uint8_t subframe);
+    DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe);
 
     /// Get DLSCH sdu for particular RNTI and Transport block index
     uint8_t* (*get_dlsch_sdu)(module_id_t Mod_id,frame_t frameP,rnti_t rnti,uint8_t TB_index);
@@ -96,7 +96,7 @@ typedef struct
     void (*mrbch_phy_sync_failure) (module_id_t Mod_id,frame_t frameP, uint8_t free_eNB_index);
 
     /// Indicate Scheduling Request from UE
-    void (*SR_indication)(module_id_t Mod_id,frame_t frameP,rnti_t rnti,uint8_t subframe);
+    void (*SR_indication)(module_id_t Mod_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
 
     /// Configure Common PHY parameters from SIB1
     void (*phy_config_sib1_eNB)(module_id_t Mod_id,
@@ -124,7 +124,7 @@ typedef struct
 
 #ifdef Rel10
     /// Get MCH sdu and corresponding MCS for particular MBSFN subframe
-    MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id,frame_t frameP,uint32_t subframe);
+    MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe);
 #endif
     // configure the cba rnti at the physical layer 
     void (*phy_config_cba_rnti)(module_id_t Mod_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
@@ -149,26 +149,26 @@ typedef struct
 
     /// Function to check if UE PHY needs to decode MCH for MAC
     /// get the sync area id, and teturn MCS value if need to decode, otherwise -1
-    int (*ue_query_mch)(module_id_t Mod_id,frame_t frameP,uint32_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
+    int (*ue_query_mch)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
 #endif
 
   /// Retrieve ULSCH sdu from MAC
-    void (*ue_get_sdu)(module_id_t Mod_id,frame_t frameP,uint8_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
+    void (*ue_get_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
 
     /// Retrieve RRCConnectionReq from MAC
-    PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,frame_t frameP,uint8_t Msg3_flag,uint8_t subframe);
+    PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe);
 
     /// Process Random-Access Response
     uint16_t (*ue_process_rar)(module_id_t Mod_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t *t_crnti,uint8_t preamble_index);
 
     /// Get SR payload (0,1) from UE MAC
-    uint32_t (*ue_get_SR)(module_id_t Mod_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,uint8_t subframe);
+    uint32_t (*ue_get_SR)(module_id_t Mod_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
 
     /// Indicate synchronization with valid PBCH
     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,uint8_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);
 
     /// PHY-Config-Dedicated UE
     void (*phy_config_dedicated_ue)(module_id_t Mod_id,uint8_t CH_index,
diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h
index 454753c6a7..f0b282aed9 100644
--- a/openair2/RRC/LITE/defs.h
+++ b/openair2/RRC/LITE/defs.h
@@ -65,6 +65,7 @@
 #include "RRCConnectionSetup.h"
 #include "RRCConnectionSetupComplete.h"
 #include "RRCConnectionRequest.h"
+#include "RRCConnectionReestablishmentRequest.h"
 #include "BCCH-DL-SCH-Message.h"
 #include "BCCH-BCH-Message.h"
 #ifdef Rel10
@@ -197,6 +198,11 @@ typedef struct eNB_RRC_UE_INFO_s {
     UE_S_TMSI Initialue_identity_s_TMSI;
     EstablishmentCause_t establishment_cause;
 
+  /* Information from UE RRC ConnectionReestablishmentRequest */
+    
+    ReestablishmentCause_t reestablishment_cause;
+
+
     /* UE id for initial connection to S1AP */
     uint16_t ue_initial_id;
 
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
index f097d53d9a..b1f0448724 100644
--- a/openair2/RRC/LITE/rrc_common.c
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -357,8 +357,7 @@ RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eN
       }
       if ((UE_rrc_inst[Mod_id].Info[index].T310_cnt % 10) == 0)
         LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", Mod_id, frameP, UE_rrc_inst[Mod_id].Info[index].T310_cnt);
-      if (UE_rrc_inst[Mod_id].Info[index].T310_cnt
-          == T310[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.t310]) {
+      if (UE_rrc_inst[Mod_id].Info[index].T310_cnt    == T310[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.t310]) {
         UE_rrc_inst[Mod_id].Info[index].T310_active = 0;
         rrc_t310_expiration (frameP, Mod_id, index);
         return (RRC_PHY_RESYNCH);
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index ae5b88ead6..83481911e4 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -48,6 +48,8 @@
 #include "COMMON/mac_rrc_primitives.h"
 #include "RRC/LITE/MESSAGES/asn1_msg.h"
 #include "RRCConnectionRequest.h"
+#include "RRCConnectionReestablishmentRequest.h"
+//#include "ReestablishmentCause.h"
 #include "UL-CCCH-Message.h"
 #include "DL-CCCH-Message.h"
 #include "UL-DCCH-Message.h"
@@ -461,6 +463,30 @@ uint8_t rrc_eNB_get_next_transaction_identifier(
 /*------------------------------------------------------------------------------*/
 /* Functions to handle UE index in eNB UE list */
 
+
+static module_id_t rrc_eNB_get_UE_index(
+    module_id_t enb_mod_idP,
+    uint64_t UE_identity) {
+
+    boolean_t      reg = FALSE;
+    module_id_t    i;
+
+    AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST);
+
+    for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+      if (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == UE_identity) {
+	// UE_identity already registered
+	reg = TRUE;
+	break;
+      }
+    }
+    
+    if (reg == FALSE) {
+      return (UE_MODULE_INVALID);
+    } else
+      return (i);
+}
+
 static module_id_t rrc_eNB_get_next_free_UE_index(
     module_id_t enb_mod_idP,
     uint64_t UE_identity) {
@@ -472,21 +498,20 @@ static module_id_t rrc_eNB_get_next_free_UE_index(
 
     for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
         if ((first_index == UE_MODULE_INVALID) && (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == 0)) {
-            first_index = i;    // save first free position
+	  first_index = i;    // save first free position
         }
 
         if (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == UE_identity) {
             // UE_identity already registered
-            reg = TRUE;
+	  reg = TRUE;
         }
     }
 
     if (reg == 0) {
-        LOG_I(RRC, "[eNB %d] Adding UE %d with identity " PRIu64 "\n", enb_mod_idP, first_index, UE_identity);
-        return (first_index);
-    } else {
-        return (UE_MODULE_INVALID);
-    }
+      LOG_I(RRC, "[eNB %d] Adding UE %d with identity " PRIu64 "\n", enb_mod_idP, first_index, UE_identity);
+      return (first_index);
+    } else
+      return (UE_MODULE_INVALID);
 }
 
 void rrc_eNB_free_UE_index(
@@ -2613,6 +2638,7 @@ int rrc_eNB_decode_ccch(
     asn_dec_rval_t                      dec_rval;
     UL_CCCH_Message_t                  *ul_ccch_msg = NULL;
     RRCConnectionRequest_r8_IEs_t      *rrcConnectionRequest;
+    RRCConnectionReestablishmentRequest_r8_IEs_t *rrcConnectionReestablishmentRequest;
     int                                 i, rval;
 
     //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
@@ -2672,13 +2698,40 @@ int rrc_eNB_decode_ccch(
                 break;
 
             case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest:
+#ifdef RRC_MSG_PRINT
+	      LOG_F(RRC, "RRC Connection Reestablishement Request\n");
+	      for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++)
+		LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]);
+	      LOG_F(RRC,"\n");
+#endif
                 LOG_D(RRC,
                       "[FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n",
                       frameP, enb_mod_idP, enb_mod_idP);
-                LOG_I(RRC, "[eNB %d] Frame %d : RRCConnectionReestablishmentRequest not supported yet\n", enb_mod_idP,
-                      frameP);
-                break;
 
+		rrcConnectionReestablishmentRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8;
+
+                LOG_I(RRC, "[eNB %d] Frame %d UE %d: RRCConnectionReestablishmentRequest cause %s\n", enb_mod_idP,
+                      frameP, 
+		      ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ?    "Other Failure" :
+		       (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : 
+		                                                                                                            "reconfigurationFailure"));
+		/*
+		{
+		  uint64_t                            c_rnti = 0;
+		  
+		  memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf,
+			 rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size);
+		  ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti);
+                }
+		
+		if ((eNB_rrc_inst[enb_mod_idP].phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && 
+		    (ue_mod_id != UE_INDEX_INVALID)){
+		  rrc_eNB_generate_RRCConnectionReestablishement(enb_mod_idP, frameP, ue_mod_id);
+		}else {
+		  rrc_eNB_generate_RRCConnectionReestablishementReject(enb_mod_idP, frameP, ue_mod_id);
+		}
+                break;
+		*/
             case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
 #ifdef RRC_MSG_PRINT
 	      LOG_F(RRC, "RRC Connection Request\n");
@@ -2690,9 +2743,7 @@ int rrc_eNB_decode_ccch(
                       "[FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND  (rrcConnectionRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n",
                       frameP, enb_mod_idP, enb_mod_idP);
 
-                rrcConnectionRequest =
-                    &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.
-                    choice.rrcConnectionRequest_r8;
+	      rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
                 {
                     uint64_t                            random_value = 0;
 
diff --git a/openair2/UTIL/CLI/cli.h b/openair2/UTIL/CLI/cli.h
index 22be78fbdf..8d87f9ddb2 100644
--- a/openair2/UTIL/CLI/cli.h
+++ b/openair2/UTIL/CLI/cli.h
@@ -124,19 +124,20 @@ char g_sid[MAX_SID];
 #define CLI_MAX_NODES 10
 
 /* The names of functions that actually do the manipulation. */
-int com_help (), com_exit ();
+int com_help (char * arg);
+int com_exit (char *arg);
 
-int prompt(),prompt_usage(), info();
+int prompt(char *arg),prompt_usage(void), info(char *arg);
 
-int start(), set();
-int start_usage(), set_usage();
+int start(char *arg), set(char *arg);
+int start_usage(void), set_usage(void);
 
 /* Forward declarations. */
-char *stripwhite ();
-command *find_command ();
+char *stripwhite (char *string);
+command *find_command (char* name);
 void abandon_input(int);
-char *command_generator ();
-char **fileman_completion ();
+//char *command_generator (void);
+//char **fileman_completion (void);
 int cli_login(const char *, int, int );
 int cli_loop(char* msg);
 int cli_set_prompt_char(void);
diff --git a/openair2/UTIL/FIFO/pad_list.c b/openair2/UTIL/FIFO/pad_list.c
index f621ad72df..3ce5ae2a48 100755
--- a/openair2/UTIL/FIFO/pad_list.c
+++ b/openair2/UTIL/FIFO/pad_list.c
@@ -1,11 +1,39 @@
-/***************************************************************************
-                             Job_list.c  -  description
-                             -------------------
-                             -------------------
-  AUTHOR  : Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER
-  COMPANY : EURECOM
-  EMAIL   : mosli@eurecom.fr, Lionel.Gauthier@eurecom.fr
- ***************************************************************************/
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2011 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
+/*! \file pad_list.c
+* \brief list management primimtives
+* \author Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER, Navid Nikaein
+* \date 2012
+* \version 0.5
+* @ingroup util
+*/
 //#define LIST_C
 //#define NULL 0
 
diff --git a/openair2/UTIL/FIFO/pad_list.h b/openair2/UTIL/FIFO/pad_list.h
index f90beeae31..4b84e2e6ce 100755
--- a/openair2/UTIL/FIFO/pad_list.h
+++ b/openair2/UTIL/FIFO/pad_list.h
@@ -1,11 +1,33 @@
-/*
-                                 list.h
-                             -------------------
-  AUTHOR  : Lionel GAUTHIER
-  COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
-
- ***************************************************************************/
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
+
 #ifndef __list_H__
 #define __list_H__
 
diff --git a/openair2/UTIL/FIFO/types.h b/openair2/UTIL/FIFO/types.h
index e6fd559c8e..063bb1ed9d 100644
--- a/openair2/UTIL/FIFO/types.h
+++ b/openair2/UTIL/FIFO/types.h
@@ -1,12 +1,54 @@
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
 #ifndef __FIFO_TYPES_H__
 #define __FIFO_TYPES_H__
 #include "platform_types.h"
 
-/* Types of events triggering the end of the simulation */
-typedef enum End_Of_Sim_Event_Type_e {FRAME, TRAFFIC} End_Of_Sim_Event_Type_t;
-
 /* Types regrouping both user-defined and regular events */
-typedef enum Event_Type_e {ET_DL, ET_UL, ET_S, ET_OMG, ET_OTG} Event_Type_t;
+typedef enum  {
+  MIN_ET=0,
+  OAI_ET=MIN_ET, // config events 
+  SYS_ET,
+  TOPO_ET,
+  APP_ET,
+  EMU_ET,
+  DL_ET, // frame events
+  UL_ET, 
+  S_ET, 
+  PHY_ET, // protocol events 
+  MAC_ET,
+  RLC_ET,
+  PDCP_ET,
+  RRC_ET,
+  MAX_ET
+} Event_Type_t;
 
 /* decomposition of node functions into jobs for a given event */
 typedef enum Job_type_e { JT_OTG, JT_PDCP, JT_PHY_MAC, JT_INIT_SYNC, JT_DL, JT_UL, RN_DL, RN_UL, JT_END} Job_Type_t;
@@ -43,8 +85,8 @@ typedef struct Packet_otg_s {
   pdcp_transmission_mode_t  mode;
 } Packet_otg_t;
 
-typedef struct Event_s {
-    enum Event_Type_e type;
+typedef struct {
+    Event_Type_t type;
     char             *key;
     void             *value;
     frame_t           frame;
@@ -59,11 +101,6 @@ typedef struct Event_s {
   double time_ms;
 };*/
 
-typedef struct End_Of_Sim_Event_s {
-    enum End_Of_Sim_Event_Type_e type;
-    int value;
-} End_Of_Sim_Event_t;
-
 typedef struct Packet_otg_elt_s {
     struct Packet_otg_elt_s *next;
     struct Packet_otg_elt_s *previous;
diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h
index db3be756bb..4417d7f6bd 100644
--- a/openair2/UTIL/OCG/OCG.h
+++ b/openair2/UTIL/OCG/OCG.h
@@ -29,7 +29,7 @@
 
 /*! \file OCG.h
 * \brief Data structure for OCG of OpenAir emulator
-* \author Lusheng Wang and Navid Nikaein
+* \author Lusheng Wang and Navid Nikaein and Andre Gomes(One source)
 * \date 2011
 * \version 1.0
 * \company Eurecom
@@ -404,6 +404,12 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
     int grid;
   } eNB_Initial_Distribution;
 
+  typedef struct
+  {
+    double pos_x;
+    double pos_y;
+  } Fixed_eNB_Distribution;
+
   ////// options of eNB_Initial_Distribution
   typedef struct
   {
@@ -428,7 +434,8 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
     eNB_Mobility_Type eNB_mobility_type;
 
     eNB_Initial_Distribution eNB_initial_distribution;
-    // ! Note: the following three options are for eNB_Initial_Distribution, we put them here for the sake of simplicity of the XML file
+    // ! Note: the following four options are for eNB_Initial_Distribution, we put them here for the sake of simplicity of the XML file
+    Fixed_eNB_Distribution fixed_eNB_distribution;
     Random_eNB_Distribution random_eNB_distribution;
     Hexagonal_eNB_Distribution hexagonal_eNB_distribution;
     Grid_eNB_Distribution grid_eNB_distribution;
@@ -664,6 +671,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
     unsigned char otg_enabled;  // openair traffic generator
     unsigned char omv_enabled; // openair mobility visulizer
     unsigned char opp_enabled; // openair performance profiler 
+    unsigned char oeh_enabled; // openair event handler, with CLI this could provide a remote event management 
     char *itti_dump_file;
     unsigned char vcd_enabled;
     char *vcd_file;
@@ -701,7 +709,6 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
     unsigned char extended_prefix_flag;
     unsigned char N_RB_DL;
     unsigned char transmission_mode;
- 
     int max_predefined_traffic_config_index;
     int max_customized_traffic_config_index;
 
diff --git a/openair2/UTIL/OCG/OCG_parse_XML.c b/openair2/UTIL/OCG/OCG_parse_XML.c
index 4de77c26e0..2d8747b535 100644
--- a/openair2/UTIL/OCG/OCG_parse_XML.c
+++ b/openair2/UTIL/OCG/OCG_parse_XML.c
@@ -29,11 +29,11 @@
 
 /*! \file OCG_parse_XML.c
 * \brief Parse the content of the XML configuration file
-* \author Lusheng Wang  & Navid Nikaein  & Aymen Hafsaoui
+* \author Lusheng Wang  & Navid Nikaein  & Aymen Hafsaoui & Andre Gomes(One Source)
 * \date 2011
 * \version 0.1
 * \company Eurecom
-* \email: lusheng.wang@eurecom.fr
+* \email: navid.nikaein@eurecom.fr
 * \note
 * \warning
 */
@@ -48,6 +48,7 @@
 #include "OCG_parse_XML.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/OTG/otg_defs.h"
+#include "UTIL/OPT/opt.h"
 /*----------------------------------------------------------------------------*/
 
 #ifndef HAVE_STRNDUP
@@ -72,7 +73,9 @@ static int inter_site_correlation_;
 static int wall_penetration_loss_dB_;
 static int system_bandwidth_MB_;
 static int system_frequency_GHz_;
+static int number_of_rbs_dl_;
 static int transmission_mode_;
+static int frame_config_;
 static int frame_type_;
 static int tdd_config_;
 static int antenna_;
@@ -123,6 +126,9 @@ static int max_journey_time_ms_;
 static int eNB_mobility_;
 static int eNB_mobility_type_;
 static int eNB_initial_distribution_;
+static int eNB_initial_coordinates_;
+static double eNB_pos_x_;
+static double eNB_pos_y_;
 static int random_eNB_distribution_;
 static int number_of_cells_;
 static int hexagonal_eNB_distribution_;
@@ -174,6 +180,8 @@ static int packet_gen_type_;
 static int emulation_config_;		/*!< \brief indicating that the parsing position is now within Emu_Config_*/
 static int emulation_time_ms_;
 static int curve_;
+static int profiling_;
+static int trace_file_;
 static int background_stats_;
 static int performance_metrics_;		/*!< \brief indicating that the parsing position is now within Performance_*/
 static int throughput_;
@@ -263,8 +271,12 @@ void start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
 		system_bandwidth_MB_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "SYSTEM_FREQUENCY_GHz")) {
 		system_frequency_GHz_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "NUMBER_OF_RBS_DL")) {
+		number_of_rbs_dl_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "TRANSMISSION_MODE")) {
 		transmission_mode_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "FRAME_CONFIG")) {
+		frame_config_ = 1;	
 	} else if (!xmlStrcmp(name,(unsigned char*) "FRAME_TYPE")) {
 		frame_type_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "TDD_CONFIG")) {
@@ -297,7 +309,6 @@ void start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
 		antenna_orientation_degree_2_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "ANTENNA_ORIENTATION_degree3")) {
 		antenna_orientation_degree_3_ = 1;
-
 	} else if (!xmlStrcmp(name,(unsigned char*) "TOPOLOGY_CONFIG")) {
 		topology_config_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "AREA")) {
@@ -364,6 +375,12 @@ void start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
 		eNB_mobility_type_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "eNB_INITIAL_DISTRIBUTION")) {
 		eNB_initial_distribution_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "eNB_INITIAL_COORDINATES")) {
+		eNB_initial_coordinates_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "POS_X")) {
+		eNB_pos_x_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "POS_Y")) {
+		eNB_pos_y_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "RANDOM_eNB_DISTRIBUTION")) {
 		random_eNB_distribution_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "NUMBER_OF_CELLS")) {
@@ -399,7 +416,6 @@ void start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
 	} else if (!xmlStrcmp(name,(unsigned char*) "OMV")) {
 		omv_ = 1;
 	}
-
 	else if (!xmlStrcmp(name, (unsigned char*) "APPLICATION_CONFIG")) {
 		application_config_ = 1;
 		oai_emulation.info.max_predefined_traffic_config_index = 0;
@@ -494,13 +510,16 @@ void start_element(void *user_data, const xmlChar *name, const xmlChar **attrs)
 		stream_ = 1;
 	} else if (!xmlStrcmp(name, (unsigned char*) "DESTINATION_PORT")) {
 		destination_port_ = 1;
-
 	} else if (!xmlStrcmp(name,(unsigned char*) "EMULATION_CONFIG")) {
 		emulation_config_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "EMULATION_TIME_ms")) {
 		emulation_time_ms_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "CURVE")) {
 		curve_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "PROFILING")) {
+		profiling_ = 1;
+	} else if (!xmlStrcmp(name,(unsigned char*) "TRACE_FILE")) {
+		trace_file_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "BACKGROUND_STATS")) {
 		background_stats_ = 1;
 	} else if (!xmlStrcmp(name,(unsigned char*) "PERFORMANCE_METRICS")) {
@@ -593,8 +612,12 @@ void end_element(void *user_data, const xmlChar *name) { // called once at the e
 		system_bandwidth_MB_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "SYSTEM_FREQUENCY_GHz")) {
 		system_frequency_GHz_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "NUMBER_OF_RBS_DL")) {
+		number_of_rbs_dl_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "TRANSMISSION_MODE")) {
 		transmission_mode_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "FRAME_CONFIG")) {
+		frame_config_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "FRAME_TYPE")) {
 		frame_type_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "TDD_CONFIG")) {
@@ -627,7 +650,6 @@ void end_element(void *user_data, const xmlChar *name) { // called once at the e
 		antenna_orientation_degree_2_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "ANTENNA_ORIENTATION_degree3")) {
 		antenna_orientation_degree_3_ = 0;
-
 	} else if (!xmlStrcmp(name,(unsigned char*) "TOPOLOGY_CONFIG")) {
 		topology_config_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "AREA")) {
@@ -694,6 +716,12 @@ void end_element(void *user_data, const xmlChar *name) { // called once at the e
 		eNB_mobility_type_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "eNB_INITIAL_DISTRIBUTION")) {
 		eNB_initial_distribution_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "eNB_INITIAL_COORDINATES")) {
+		eNB_initial_coordinates_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "POS_X")) {
+		eNB_pos_x_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "POS_Y")) {
+		eNB_pos_y_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "RANDOM_eNB_DISTRIBUTION")) {
 		random_eNB_distribution_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "NUMBER_OF_CELLS")) {
@@ -728,7 +756,6 @@ void end_element(void *user_data, const xmlChar *name) { // called once at the e
 		sumo_hport_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "OMV")) {
 	        omv_ = 0;
-	
 	} else if (!xmlStrcmp(name, (unsigned char*) "APPLICATION_CONFIG")) {
 		application_config_ = 0;
 	} else if (!xmlStrcmp(name, (unsigned char*) "PREDEFINED_TRAFFIC")) {
@@ -815,13 +842,16 @@ void end_element(void *user_data, const xmlChar *name) { // called once at the e
 		stream_ = 0;
 	} else if (!xmlStrcmp(name, (unsigned char*) "DESTINATION_PORT")) {
 		destination_port_ = 0;
-
 	} else if (!xmlStrcmp(name,(unsigned char*) "EMULATION_CONFIG")) {
 		emulation_config_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "EMULATION_TIME_ms")) {
 		emulation_time_ms_ = 0;
 	}else if (!xmlStrcmp(name,(unsigned char*) "CURVE")) {
 		curve_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "PROFILING")) {
+		profiling_ = 0;
+	} else if (!xmlStrcmp(name,(unsigned char*) "TRACE_FILE")) {
+		trace_file_ = 0;
 	}else if (!xmlStrcmp(name,(unsigned char*) "BACKGROUND_STATS")) {
 		background_stats_ = 0;
 	} else if (!xmlStrcmp(name,(unsigned char*) "PERFORMANCE_METRICS")) {
@@ -911,12 +941,21 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
 				oai_emulation.environment_system_config.system_bandwidth_MB = atof(ch);
 			} else if (system_frequency_GHz_) {
 				oai_emulation.environment_system_config.system_frequency_GHz = atof(ch);
+			} else if (number_of_rbs_dl_) {
+				oai_emulation.info.N_RB_DL = atoi(ch);
 			} else if (transmission_mode_) {
-				oai_emulation.info.transmission_mode = atof(ch);
-			} else if (frame_type_) {
-			  oai_emulation.info.frame_type_name =  strndup(ch, len);
-			} else if (tdd_config_) {
-				oai_emulation.info.tdd_config = atof(ch);
+				oai_emulation.info.transmission_mode = atoi(ch);
+			} else if (frame_config_) {
+				if (frame_type_) {
+					oai_emulation.info.frame_type = atoi(ch);
+					if (oai_emulation.info.frame_type) {
+						oai_emulation.info.frame_type_name = "TDD";
+					} else {
+						oai_emulation.info.frame_type_name = "FDD";
+					}
+				} else if (tdd_config_) {
+					oai_emulation.info.tdd_config = atoi(ch);
+				}
 			} else if (antenna_) {
 				if (eNB_antenna_) {
 					if (number_of_sectors_) {
@@ -1045,6 +1084,13 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
 						oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = strndup(ch, len);
 					} else if (eNB_initial_distribution_) {
 						oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = strndup(ch, len);
+					} else if (eNB_initial_coordinates_) {
+						if (eNB_pos_x_) {
+							oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x = atof(ch);
+					    }
+						else if (eNB_pos_y_) {
+							oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y = atof(ch);
+						}
 					} else if (random_eNB_distribution_) {
 						if (number_of_cells_) {
 							oai_emulation.topology_config.mobility.eNB_mobility.random_eNB_distribution.number_of_cells = atoi(ch);
@@ -1184,7 +1230,20 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
 		    oai_emulation.emulation_config.emulation_time_ms = atof(ch);
 		  } else if (curve_) {
 		    oai_emulation.emulation_config.curve = strndup(ch, len);
- 			} else if (background_stats_) {
+		  } else if (profiling_) {
+			oai_emulation.info.opp_enabled = atoi(ch);
+		  } else if (trace_file_) {
+		  	oai_emulation.info.opt_enabled = 1;
+		  	if (strcmp(strndup(ch, len), "wireshark") == 0) {
+            	opt_type = OPT_WIRESHARK;
+        	} else if (strcmp(strndup(ch, len), "pcap") == 0) {
+            	opt_type = OPT_PCAP;
+        	} else {
+            	opt_type = OPT_NONE;
+            	oai_emulation.info.opt_enabled = 0;
+        	}
+        	oai_emulation.info.opt_mode = opt_type;
+ 		  } else if (background_stats_) {
 		    oai_emulation.emulation_config.background_stats = strndup(ch, len);
 		  }else if (performance_metrics_) {
 		    if (throughput_) {
diff --git a/openair2/UTIL/OMG/common.c b/openair2/UTIL/OMG/common.c
index cf92c645ed..fb83065451 100644
--- a/openair2/UTIL/OMG/common.c
+++ b/openair2/UTIL/OMG/common.c
@@ -158,14 +158,9 @@ Node_list remove_node_entry(NodePtr node, Node_list Node_Vector){
 // display list of nodes
 void display_node_list(Node_list Node_Vector){
     Node_list tmp = Node_Vector;
-    if (tmp == NULL){
-      #ifdef STANDALONE  
-        printf("Empty Node_list\n");
-      #else
-        LOG_I(OMG, "Empty Node_list\n");
-      #endif
-    }	
-    while (tmp != NULL){
+    
+    while ((tmp != NULL) &&
+	   (tmp->node != NULL)){
       LOG_I(OMG,"[%s][%s] Node of ID %d is %s. Now, it is at location (%.3f, %.3f)\n", 
 	    map_int_to_str(mob_type, tmp->node->generator),
 	    map_int_to_str(nodes_type, tmp->node->type),  
diff --git a/openair2/UTIL/OMG/defs.h b/openair2/UTIL/OMG/defs.h
index d26906ac37..6ee2b6c71f 100644
--- a/openair2/UTIL/OMG/defs.h
+++ b/openair2/UTIL/OMG/defs.h
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Eurecom OpenAirInterface
-  Copyright(c) 1999 - 2011 Eurecom
+  Copyright(c) 1999 - 2014 Eurecom
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -28,9 +28,16 @@
 *******************************************************************************/
 
 /**
- * \file defs.h
- * \brief Typedefs & Prototypes of OMG functions
- */
+* \file defs.h
+* \brief Typedefs & Prototypes of OMG functions
+* \author Navid Nikaein and Andre Gomes (one source)
+* \date 2014
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr
+* \note
+* \warning
+*/
 
 #ifndef __DEFS_H__
 #define  __DEFS_H__
@@ -114,6 +121,9 @@ typedef struct omg_global_param{
 	double max_X; /*!< The maximum value that the X coordinate might take, i.e the maximum boundary of the simulation area according to the X axis*/
 	double min_Y; /*!< The minimum value that the Y coordinate might take, i.e the minimum boundary of the simulation area according to the Y axis */
 	double max_Y; /*!< The minimum value that the Y coordinate might take, i.e the maximum boundary of the simulation area according to the Y axis */
+	bool user_fixed; /*!< Sets if the coordinates are user defined*/
+	double fixed_X; /*!< The user defined x value*/
+	double fixed_Y; /*!< The user defined y value*/
 	double min_speed; /*!< The minimum speed. It should be different than 0.0 in order to avoid instability*/ 
 	double max_speed; /*!< The maximum allowed speed */ 
 	double min_journey_time; /*!< The minimum allowed trip duration. It should be different than 0.0 in order to avoid instability and properly reflect the mobility model behavior */ 
diff --git a/openair2/UTIL/OMG/static.c b/openair2/UTIL/OMG/static.c
index e2c01ea2ed..85a14f3310 100644
--- a/openair2/UTIL/OMG/static.c
+++ b/openair2/UTIL/OMG/static.c
@@ -29,11 +29,11 @@
 
 /*! \file rwalk.c
 * \brief static  mobility generator 
-* \author  M. Mahersi,  J. Harri, N. Nikaein,
+* \author  M. Mahersi,  J. Harri, N. Nikaein, Andre Gomes (One source)
 * \date 2011
 * \version 0.1
 * \company Eurecom
-* \email: 
+* \email: openair_tech@eurecom.fr
 * \note
 * \warning
 */
@@ -84,13 +84,28 @@ void start_static_generator(omg_global_param omg_param_list) {
 
 
 void place_static_node(NodePtr node) {
- 	
-  node->X_pos = (double) ((int) (randomGen(omg_param_list.min_X, omg_param_list.max_X)*100))/ 100;
-  node->mob->X_from = node->X_pos;
-  node->mob->X_to = node->X_pos;
-  node->Y_pos = (double) ((int) (randomGen(omg_param_list.min_Y,omg_param_list.max_Y)*100))/ 100;
-  node->mob->Y_from = node->Y_pos;
-  node->mob->Y_to = node->Y_pos;
+  if (omg_param_list.user_fixed && node->type == eNB) {
+    if (omg_param_list.fixed_X <= omg_param_list.max_X && omg_param_list.fixed_X >= omg_param_list.min_X)
+        node->X_pos = omg_param_list.fixed_X;
+    else
+        node->X_pos = (double) ((int) (randomGen(omg_param_list.min_X, omg_param_list.max_X)*100))/ 100;
+    node->mob->X_from = node->X_pos;
+    node->mob->X_to = node->X_pos;
+    if (omg_param_list.fixed_Y <= omg_param_list.max_Y && omg_param_list.fixed_Y >= omg_param_list.min_Y)
+        node->Y_pos = omg_param_list.fixed_Y;
+    else
+        node->Y_pos = (double) ((int) (randomGen(omg_param_list.min_Y,omg_param_list.max_Y)*100))/ 100;
+    node->mob->Y_from = node->Y_pos;
+    node->mob->Y_to = node->Y_pos;
+  }
+  else {
+    node->X_pos = (double) ((int) (randomGen(omg_param_list.min_X, omg_param_list.max_X)*100))/ 100;
+    node->mob->X_from = node->X_pos;
+    node->mob->X_to = node->X_pos;
+    node->Y_pos = (double) ((int) (randomGen(omg_param_list.min_Y,omg_param_list.max_Y)*100))/ 100;
+    node->mob->Y_from = node->Y_pos;
+    node->mob->Y_to = node->Y_pos;
+  }
   
   node->mob->speed = 0.0;
   node->mob->journey_time = 0.0;
diff --git a/openair2/UTIL/OSD/form.php b/openair2/UTIL/OSD/form.php
index 4eb735a597..d8cb1e5d83 100644
--- a/openair2/UTIL/OSD/form.php
+++ b/openair2/UTIL/OSD/form.php
@@ -29,21 +29,29 @@
 					<input type="radio" name="smallscale" value="EVA">EVA<br>
 					<input type="radio" name="smallscale" value="ETU">ETU<br>
 					<input type="radio" name="smallscale" value="Rayleigh8">Rayleigh8<br>
-					<input type="radio" name="smallscale" value="Rayleigh1" checked>Rayleigh1<br>
+					<input type="radio" name="smallscale" value="Rayleigh1">Rayleigh1<br>
 					<input type="radio" name="smallscale" value="Rayleigh1_corr">Rayleigh1_corr<br>
 					<input type="radio" name="smallscale" value="Rayleigh1_anticorr">Rayleigh1_anticorr<br>
 					<input type="radio" name="smallscale" value="Rice8">Rice8<br>
 					<input type="radio" name="smallscale" value="Rice1">Rice1<br>
 					<input type="radio" name="smallscale" value="Rice1_corr">Rice1_corr<br>
 					<input type="radio" name="smallscale" value="Rice1_anticorr">Rice1_anticorr<br>
-					<input type="radio" name="smallscale" value="AWGN">AWGN<br>
+					<input type="radio" name="smallscale" value="AWGN" checked>AWGN<br>
 			</div>
 			
 			<div class="span-7">
 			<h4><u>Other parameters</u></h4>
 				<label>Wall penetration loss</label><input name="wallpenetloss" id="wallpenetloss" size="3" maxlength="4" value="5" class="required"> dB<span class="message"></span><br>
-				<label>System Bandwidth : </label><input name="sysbw" id="sysbw" size="3" maxlength="4" value="7.68" class="required"> MHz<span class="message"></span><br>
-				<label>UE Frequency : </label><input name="uefreq" id="uefreq" size="3" maxlength="4" value="1.9" class="required"> GHz<span class="message"></span><br>				
+				<label>System Bandwidth : </label><input name="sysbw" id="sysbw" size="3" maxlength="4" value="5" class="required"> MHz<span class="message"></span><br>
+				<label>UE Frequency : </label><input name="uefreq" id="uefreq" size="3" maxlength="4" value="1.9" class="required"> GHz<span class="message"></span><br>
+				<label>Number of RBs DL (6,15,25,50,75,100) : </label><input name="num_rbs_dl" id="num_rbs_dl" size="3" maxlength="4" value="25"><span class="message"></span><br>
+                <label>Target DL MCS : </label><input name="dl_mcs" id="dl_mcs" size="3" maxlength="4" value="20"><span class="message"></span><br>
+                <label>Target UL MCS : </label><input name="ul_mcs" id="ul_mcs" size="3" maxlength="4" value="16"><span class="message"></span><br>
+                <label>SNR : </label><input name="snr" id="snr" size="3" maxlength="4" value="15"><span class="message"></span><br>
+                <label>Transmission Mode (1,2,5,6) : </label><input name="transmission_mode" id="transmission_mode" size="3" maxlength="4" value="1"><span class="message"></span><br>
+                <br><label>Frame Type : </label><br>
+                <input type="radio" name="frame_type" value="1" checked>TDD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label>Frame Config (0-6) : </label><input name="tdd_config" id="tdd_config" size="3" maxlength="4" value="1"><span class="message"></span><br>
+                <input type="radio" name="frame_type" value="0">FDD<br>			
 			</div>
 			
 			<div class="span-10">
@@ -161,10 +169,13 @@
 			
 			<div class="span-7">
 				<label>eNB Initial Distribution : </label><br>
-					<input type="radio" name="eNB_initial_distribution" value="random" checked> Random <!--<span id="random" style="display">-> Number of cells :<input name="nbenbs" id="nbenbs" size="1" maxlength="4" value="1" class="required"><span class="message"></span></span>--><br>
-					<input type="radio" name="eNB_initial_distribution" value="grid" class="disabled"> Grid <!-- <span id="grid" style="display:none">-> Grid X value :<input name="gridx" id="gridx" size="1" maxlength="4" value="1" class="required"><span class="message"></span>Grid Y value :<input name="gridy" id="gridy" size="1" maxlength="4" value="1" class="required"><span class="message"></span></span>--><br>
-					<input type="radio" name="eNB_initial_distribution" value="hexagonal" class="disabled"> Hexagonal <!--<span id="hexagonal" style="display:none">-> Number of Cells :<input name="hexanbcells" id="hexabncells" size="1" maxlength="4" value="1" class="required"><span class="message"></span> Inter eNB distance :<input name="interenbdist" id="interenbdist" size="1" maxlength="4" value="1" class="required"> km<span class="message"></span></span>--><br>
-					<br>
+					<input type="radio" name="eNB_initial_distribution" value="fixed" checked> Fixed <br>
+                    Pos X : <input name="pos_x" id="pos_x" size="4" maxlength="4" value="250" class="required"> m<span class="message"></span><br>
+                    Pos Y : <input name="pos_y" id="pos_y" size="4" maxlength="4" value="250" class="required"> m<span class="message"></span><br>
+                    <input type="radio" name="eNB_initial_distribution" value="random"> Random <!--<span id="random" style="display">-> Number of cells :<input name="nbenbs" id="nbenbs" size="1" maxlength="4" value="1" class="required"><span class="message"></span></span>--><br>
+                    <input type="radio" name="eNB_initial_distribution" value="grid" class="disabled"> Grid <!-- <span id="grid" style="display:none">-> Grid X value :<input name="gridx" id="gridx" size="1" maxlength="4" value="1" class="required"><span class="message"></span>Grid Y value :<input name="gridy" id="gridy" size="1" maxlength="4" value="1" class="required"><span class="message"></span></span>--><br>
+                    <input type="radio" name="eNB_initial_distribution" value="hexagonal" class="disabled"> Hexagonal <!--<span id="hexagonal" style="display:none">-> Number of Cells :<input name="hexanbcells" id="hexabncells" size="1" maxlength="4" value="1" class="required"><span class="message"></span> Inter eNB distance :<input name="interenbdist" id="interenbdist" size="1" maxlength="4" value="1" class="required"> km<span class="message"></span></span>--><br>
+                    <br>
 				
 				<label>Random eNB Distribution : </label><br>
 					Number of Cells : <input name="random_eNB_distr" id="random_eNB_distr" size="1" maxlength="4" value="1"><span class="message"></span><br><br>
@@ -310,7 +321,15 @@
 			<input name="throughput" value="1"  type="checkbox" class="required" > Throughput<span class="message"></span><br>
 			<input name="latency" value="1"  type="checkbox" class="required" > Latency<span class="message"></span><br>
 			<input name="lossrate" value="1" type="checkbox" class="required"> Loss Rate<span class="message"></span><br>
-			<br>	
+			<br>
+            <input name="phy_abstraction" value="1" type="checkbox" class="required"> PHY Abstraction<span class="message"></span><br>
+            <input name="profiling" value="1" type="checkbox" class="required" checked> Profiling Statistics<span class="message"></span><br>
+            <input name="pcap_trace" value="1" type="checkbox" class="required"> PCAP Trace<span class="message"></span><br>
+            <br>
+            <input name="cli_enabled" value="1" type="checkbox" class="required"> CLI Enabled<span class="message"></span><br>
+            <input name="cli_start_enb" value="1" type="checkbox" class="required"> CLI Start eNB<span class="message"></span><br>
+            <input name="cli_start_ue" value="1" type="checkbox" class="required"> CLI Start UE<span class="message"></span><br>
+            <br>
 			<input name="curves" value="1" type="checkbox" class="required"> Show Curves (not working)<span class="message"></span><br>
 		</div>	
 		<div class="span-6">
diff --git a/openair2/UTIL/OSD/header.php b/openair2/UTIL/OSD/header.php
index ba5791e983..fe2cf57a19 100644
--- a/openair2/UTIL/OSD/header.php
+++ b/openair2/UTIL/OSD/header.php
@@ -1,4 +1,12 @@
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<?php
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+?>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<meta http-equiv="pragma" content="no-cache">
 
 <title>OpenAirEmulation Scenario Descriptor - Basic Scenario</title>
 <link type="text/css" rel="stylesheet" media="screen,projection" href="/OSD/css/screen.css?8" />
@@ -42,22 +50,31 @@ $(function(){
 	
 	// PART 2 - BUTTON eNB TOPOLOGY  
 	$(":radio[name='eNB_initial_distribution']").click(function(){ 
-		if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'random') {
-			$("#grid").hide(1);
-			$("#hexagonal").hide(1);
-			$("#random").show(1);
-		}
-		if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'grid') {
-			$("#grid").show(1);
-			$("#hexagonal").hide(1);
-			$("#random").hide(1);
-		}	
-		if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'hexagonal') {
-			$("#grid").hide(1);
-			$("#hexagonal").show(1);
-			$("#random").hide(1);
-		}
-	}); 
+	    if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'random') {
+            $("#grid").hide(1);
+            $("#hexagonal").hide(1);
+            $("#random").hide(1);
+            $("#fixed").show(1);
+	    }
+	    if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'random') {
+            $("#grid").hide(1);
+            $("#hexagonal").hide(1);
+            $("#random").show(1);
+            $("#fixed").hide(1);
+	    }
+	    if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'grid') {
+            $("#grid").show(1);
+            $("#hexagonal").hide(1);
+            $("#random").hide(1);
+            $("#fixed").hide(1);
+	    }       
+	    if ($(":radio[name='eNB_initial_distribution']:checked").val() == 'hexagonal') {
+            $("#grid").hide(1);
+            $("#hexagonal").show(1);
+            $("#random").hide(1);
+            $("#fixed").hide(1);
+	    }
+	});
 	
 	// PART 2 - BUTTON UE DISTRIBUTION
 	$(":radio[name='uedistr']").click(function(){ 
diff --git a/openair2/UTIL/OSD/recep.php b/openair2/UTIL/OSD/recep.php
index 2c264515ee..2f0ef226b4 100644
--- a/openair2/UTIL/OSD/recep.php
+++ b/openair2/UTIL/OSD/recep.php
@@ -1,3 +1,44 @@
+<?php
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
+/*! \file recep.php
+* \brief Process the POST of the OSD form.
+* \author Philippe Foubert & Navid Nikaein & Andre Gomes (One Source)
+* \date 2014
+* \version 0.1
+* \company Eurecom, 
+* \email: openair_tech@eurecom.fr
+* \note
+* \warning
+*/
+?>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -39,6 +80,16 @@ if ( isset($_POST['lossrate'])   && $_POST['lossrate'] == '1' ) { $LOSS_RATE = 1
 if ( isset($_POST['pkttrace'])   && $_POST['pkttrace'] == '1' ) { $PKTTRACE = 1; } else { $PKTTRACE = 0; }
 if ( isset($_POST['bg_traffic']) &&  $_POST['bg_traffic'] == '1' ) { $BG_TRAFFIC = 1; } else { $BG_TRAFFIC = 0; }
 if ( isset($_POST['curves'])     && $_POST['curves'] == '1' ) { $CURVES = enabled; } else { $CURVES = disabled; }
+// More parameters
+if ( isset($_POST['phy_abstraction']) &&  $_POST['phy_abstraction'] == '1' ) { $PHY_ABSTRACTION = '-a'; } else { $PHY_ABSTRACTION = ''; }
+if ( isset($_POST['pcap_trace']) &&  $_POST['pcap_trace'] == '1' ) { $PCAP_TRACE = 1; } else { $PCAP_TRACE = 0; }
+if ( isset($_POST['profiling']) && $_POST['profiling'] == '1' ) { $PROFILING = 1; } else { $PROFILING = 0; }
+if ( isset($_POST['dl_mcs'])) { $DL_MCS = '-m' . $_POST['dl_mcs']; } else { $DL_MCS = ''; }
+if ( isset($_POST['ul_mcs'])) { $UL_MCS = '-t' . $_POST['ul_mcs']; } else { $UL_MCS = ''; }
+if ( isset($_POST['snr'])) { $SNR = '-s' . $_POST['snr']; } else { $SNR = ''; }
+if ( isset($_POST['transmission_mode'])) { $TRANSMISSION_MODE = $_POST['transmission_mode']; } else { $TRANSMISSION_MODE = ''; }
+if ( isset($_POST['frame_type'])) { $FRAME_TYPE = $_POST['frame_type']; } else { $FRAME_TYPE = ''; }
+if ( isset($_POST['tdd_config'])) { $TDD_CONFIG = '<TDD_CONFIG>'.$_POST['tdd_config'].'</TDD_CONFIG>'; } else { $TDD_CONFIG = ''; }
 
 // VARIABLES FOR BOTH WEBPORTAL AND PORTABLE VERSION
 $espace= array(" ");
@@ -48,6 +99,53 @@ $ID = $PERSON.$date;
 $user = $_POST['username'];
 $XML_FILENAME = str_replace($espace, "", $user).'.'.$date.'.xml';
 
+// eNB Distribution
+if (isset($_POST['eNB_initial_distribution']) && $_POST['eNB_initial_distribution'] == 'fixed') {
+$eNB_INITIAL_DISTRIBUTION       =
+        '<eNB_INITIAL_DISTRIBUTION>fixed</eNB_INITIAL_DISTRIBUTION>
+                <eNB_INITIAL_COORDINATES>
+                        <POS_X>'.nospace($_POST['pos_x']).'</POS_X>
+                        <POS_Y>'.nospace($_POST['pos_y']).'</POS_Y>
+                </eNB_INITIAL_COORDINATES>';
+                }
+elseif (isset($_POST['eNB_initial_distribution']) && $_POST['eNB_initial_distribution'] == 'random') {
+$eNB_INITIAL_DISTRIBUTION       =
+        '<eNB_INITIAL_DISTRIBUTION>random</eNB_INITIAL_DISTRIBUTION>
+                <RANDOM_eNB_DISTRIBUTION>
+                        <NUMBER_OF_CELLS>'.nospace($_POST['random_eNB_distr']).'</NUMBER_OF_CELLS>
+                </RANDOM_eNB_DISTRIBUTION>';
+                }
+
+// RBs
+if (isset($_POST['num_rbs_dl'])) {
+	$NUMBER_OF_RBS = '<NUMBER_OF_RBS_DL>'.$_POST['num_rbs_dl'].'</NUMBER_OF_RBS_DL>';
+}
+else {
+	$NUM_RBS = '';
+}
+
+// PCAP
+if ($PCAP_TRACE == 1) {
+	$TRACE_FILE = '<TRACE_FILE>pcap</TRACE_FILE>';
+}
+else {
+	$TRACE_FILE = '';
+}
+
+// CLI
+if ( isset($_POST['cli_enabled']) && $_POST['cli_enabled'] == '1' ) {
+	if ( isset($_POST['cli_start_enb']) && $_POST['cli_start_enb'] == '1' ) { $CLI_START_ENB = 1; } else { $CLI_START_ENB = 0; }
+	if ( isset($_POST['cli_start_ue']) && $_POST['cli_start_ue'] == '1' ) { $CLI_START_UE = 1; } else { $CLI_START_UE = 0; }
+	$CLI =
+	'<CLI>
+		<START_ENB>'.$CLI_START_ENB.'</START_ENB>
+		<START_UE>'.$CLI_START_UE.'</START_UE>
+	</CLI>';
+}
+else {
+	$CLI = '';
+}
+
 // ICI TOUTES LES OPTIONS - ELLES SONT COMMENTEES EN BAS DU FICHIER
 
 // <!-- Here is the XML template which will be filled in with the user values -->
@@ -66,6 +164,12 @@ $data = '
 		<WALL_PENETRATION_LOSS_dB>'.nospace($_POST['wallpenetloss']).'</WALL_PENETRATION_LOSS_dB>
 		<SYSTEM_BANDWIDTH_MB>'.nospace($_POST['sysbw']).'</SYSTEM_BANDWIDTH_MB>
 		<SYSTEM_FREQUENCY_GHz>'.nospace($_POST['uefreq']).'</SYSTEM_FREQUENCY_GHz>
+		'.$NUMBER_OF_RBS.'
+		<TRANSMISSION_MODE>'.$TRANSMISSION_MODE.'</TRANSMISSION_MODE>
+		<FRAME_CONFIG>
+			<FRAME_TYPE>'.$FRAME_TYPE.'</FRAME_TYPE>
+			'.$TDD_CONFIG.'
+		</FRAME_CONFIG>
 		<ANTENNA>
 			<eNB_ANTENNA>
 				<RX_NOISE_LEVEL_dB>'.nospace($_POST['eNB_RX_noise_power']).'</RX_NOISE_LEVEL_dB>
@@ -106,11 +210,7 @@ $data = '
 				</UE_MOVING_DYNAMICS>
 			</UE_MOBILITY>
 			<eNB_MOBILITY>
-				<eNB_INITIAL_DISTRIBUTION>'.nospace($_POST['eNB_initial_distribution']).'</eNB_INITIAL_DISTRIBUTION>
-				<RANDOM_eNB_DISTRIBUTION>
-					<NUMBER_OF_CELLS>'.nospace($_POST['random_eNB_distr']).'</NUMBER_OF_CELLS>
-				</RANDOM_eNB_DISTRIBUTION>
-
+   				'.nospace($eNB_INITIAL_DISTRIBUTION).'
 				<eNB_MOBILITY_TYPE>'.nospace($_POST['enbmobility']).'</eNB_MOBILITY_TYPE> 
 			</eNB_MOBILITY>
 		</MOBILITY>
@@ -162,6 +262,8 @@ $data = '
 	<EMULATION_CONFIG>
 		<EMULATION_TIME_ms>'.nospace($_POST['emutime']).'</EMULATION_TIME_ms>
 		<CURVE>'.$CURVES.'</CURVE>
+		<PROFILING>'.$PROFILING.'</PROFILING>
+		'.$TRACE_FILE.'
 		<PERFORMANCE_METRICS>
 			    <THROUGHPUT>'.$THROUGHPUT.'</THROUGHPUT>
 			    <LATENCY>'.$LATENCY.'</LATENCY>
@@ -175,6 +277,7 @@ $data = '
 			</LOG>
 			<PACKET_TRACE>'.$PKTTRACE.'</PACKET_TRACE>
 			<SEED_VALUE>'.nospace($_POST['seedvalue']).'</SEED_VALUE>
+			'.$CLI.'
 	</EMULATION_CONFIG>
 	<PROFILE>'.$XML_FILENAME.'</PROFILE>	
 </OAI_EMULATION>
@@ -206,27 +309,82 @@ $RESULTS_PATH_EMULATION = $RESULTS_PATH."/".str_replace($espace, "", $user)."/".
 //$RESULTS_PATH_EMULATION_LOGS = $RESULTS_PATH_EMULATION."LOGS/";
 //$RESULTS_PATH_EMULATION_XML = $RESULTS_PATH_EMULATION."SCENARIO/XML/";
 
+// PROFILING and PCAP Copy
+if ($PROFILING == 1) {
+	$PROFILING_PARSE = '2>profiling.log';
+	$PROFILING_COPY = ' ; cp profiling.log '.$RESULTS_PATH_EMULATION;
+}
+else {
+	$PROFILING_PARSE = '';
+	$PROFILING_COPY = '';
+}
+if ($PCAP_TRACE == 1) {
+	$PCAP_COPY = ' ; cp oai_opt.pcap '.$RESULTS_PATH_EMULATION;
+}
+else {
+	$PCAP_COPY = '';
+}
+
 // -1 : portable, 0: web portal, # for templates  
 // 2 - STARTING OAISIM 
 // $OAISIM=shell_exec("set -x ; mkdir /tmp/$ID ; cd /tmp/$ID ; export OPENAIR1_DIR=$OPENAIR1_DIR ; export OPENAIR2_DIR=$OPENAIR2_DIR ; export OPENAIR3_DIR=$OPENAIR3_DIR ; export OPENAIR_TARGETS=$OPENAIR_TARGETS ; $OPENAIR_TARGETS/SIMU/USER/oaisim -a -c $XML_FILENAME >oaisim.log ; mv * $RESULTS_PATH_EMULATION_LOGS ; rmdir /tmp/$ID ");
 
-$OAISIM="set -x ; mkdir /tmp/$ID ; cd /tmp/$ID ; export OPENAIR1_DIR=$OPENAIR1_DIR ; export OPENAIR2_DIR=$OPENAIR2_DIR ; export OPENAIR3_DIR=$OPENAIR3_DIR ; export OPENAIR_TARGETS=$OPENAIR_TARGETS ; $OPENAIR_TARGETS/SIMU/USER/oaisim -a -c -1 >oaisim.log ; cp oaisim.log $RESULTS_PATH_EMULATION";
+$OAISIM="set -x ; mkdir /tmp/$ID ; cd /tmp/$ID ; export OPENAIR1_DIR=$OPENAIR1_DIR ; export OPENAIR2_DIR=$OPENAIR2_DIR ; export OPENAIR3_DIR=$OPENAIR3_DIR ; export OPENAIR_TARGETS=$OPENAIR_TARGETS ; $OPENAIR_TARGETS/SIMU/USER/oaisim $PHY_ABSTRACTION $SNR $DL_MCS $UL_MCS -c -1 >oaisim.log ".$PROFILING_PARSE." ; cp oaisim.log $RESULTS_PATH_EMULATION".$PROFILING_COPY.$PCAP_COPY;
 
 //echo $OAISIM; 
 
 shell_exec($OAISIM);
 
+// Get hostname
+if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+	$hostname = gethostname();
+}
+elseif (version_compare(PHP_VERSION, '4.2.0') >= 0) {
+	$hostname = php_uname('n');
+}
+elseif (version_compare(PHP_VERSION, '4.2.0') < 0) {
+	$hostname = getenv('HOSTNAME'); 
+	if(!$hostname) $hostname = trim(`hostname`); 
+	if(!$hostname) $hostname = exec('echo $HOSTNAME');
+	if(!$hostname) $hostname = preg_replace('#^\w+\s+(\w+).*$#', '$1', exec('uname -a'));
+}
+
 // APACHE VARIABLES
-$RESULTS_PATH="http://localhost/results/";
-$XMLFILE_PATH="http://localhost/xmlfile/";
+$RESULTS_PATH="http://".$hostname."/results/";
+$XMLFILE_PATH="http://".$hostname."/xmlfile/";
 
+// PROFILING and PCAP Results
+if ($PROFILING == 1) {
+	$PROFILING_OUTPUT = '
+	<div align="center" class="notice span-9">
+		<br>
+		<p>Here are the performance profiling statistics :
+		<br>
+		<a href="'.$RESULTS_PATH.str_replace($espace, "", $user).'/'.$date.'/profiling.log" target="_blank">profiling.log</a></p>
+	</div>';
+}
+else {
+	$PROFILING_OUTPUT = '';
+}
+if ($PCAP_TRACE == 1) {
+	$PCAP_OUTPUT = '
+	<div align="center" class="notice span-9">
+		<br>
+		<p>Here is the PCAP File :
+		<br>
+		<a href="'.$RESULTS_PATH.str_replace($espace, "", $user).'/'.$date.'/oai_opt.pcap" target="_blank">oai_opt.pcap</a></p>
+	</div>';
+}
+else {
+	$PCAP_OUTPUT = '';
+}
 
 //
 // 3 - DISPLAY RESULTS
-// 
+//
+
 // THE FIRST SQUARE  - XML FILE
 echo '
-
 <div class=" span-50">
       <br>
     </div>
@@ -237,33 +395,29 @@ echo '
     </div>
 
     <div align="center" class=" span-10">
-       <div class="success span-9">
-	  <br>
-	    <p>Here is the XML file of your OpenAirEmulation :
-	    <br>
-	    <a href="'.$RESULTS_PATH.str_replace($espace, "", $user).'/'.$date.'/'.$XML_FILENAME.'" target="_blank">'.$XML_FILENAME.'</a></p>
-	   </div>
-
-       <div align="center" class="info span-9">
-	  <br>
-	    <p>Here is the output of your OpenAirEmulation :
-	    <br>
-	    <a href="'.$RESULTS_PATH.str_replace($espace, "", $user).'/'.$date.'/oaisim.log" target="_blank">oaisim.log</a></p>
-	</div>
-
-	<div align="center" class="notice span-9">
-	  <br>
-	    <p>For the future:
-	    <br>
-	    </p>
-	</div>
-     </div>
-
-     <div class=" span-10">
-	  <br>
-     </div>
+		<div class="success span-9">
+			<br>
+			<p>Here is the XML file of your OpenAirEmulation :
+			<br>
+			<a href="'.$RESULTS_PATH.str_replace($espace, "", $user).'/'.$date.'/'.$XML_FILENAME.'" target="_blank">'.$XML_FILENAME.'</a></p>
+		</div>
+
+		<div align="center" class="info span-9">
+			<br>
+			<p>Here is the output of your OpenAirEmulation :
+			<br>
+			<a href="'.$RESULTS_PATH.str_replace($espace, "", $user).'/'.$date.'/oaisim.log" target="_blank">oaisim.log</a></p>
+		</div>
+
+		'.$PROFILING_OUTPUT.'
+
+		'.$PCAP_OUTPUT.'
+
+		<div class=" span-10">
+			<br>
+		</div>
 </div>
-    ';
+';
 
 
 /*
diff --git a/openair2/UTIL/OTG/otg_kpi.c b/openair2/UTIL/OTG/otg_kpi.c
index 09de8cb84a..a3927da034 100644
--- a/openair2/UTIL/OTG/otg_kpi.c
+++ b/openair2/UTIL/OTG/otg_kpi.c
@@ -251,7 +251,7 @@ fc=fopen("/tmp/otg.log","w");;
 	rx_loss_rate_pkts(i,j,k);
 	average_pkt_jitter(i,j,k);
 
-	//	LOG_I(OTG,"KPI: (src=%d, dst=%d, traffic=%d) NB packet TX= %d,  NB packet RX= %d\n ", i, j,  k,otg_info->tx_num_pkt[i][j][k],  otg_info->rx_num_pkt[i][j][k]);
+	//	LOG_I(OTG,"KPI: (src=%d, dst=%d, traffic=%d) NB packet TX= %d,  NB packet RX= %d\n ",i, j,  k,otg_info->tx_num_pkt[i][j][k],  otg_info->rx_num_pkt[i][j][k]);
 	
 	if (otg_multicast_info->tx_throughput[i][j]>0)  { 
 	  //multicast
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf
index 1998d65ca5..6cd790e6a7 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_0");
+Active_eNBs = ( "eNB_Eurecom_1");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 eNBs =
diff --git a/targets/SIMU/EXAMPLES/OSD/WEBXML/template_13.xml b/targets/SIMU/EXAMPLES/OSD/WEBXML/template_13.xml
index 0fea1fc6b8..4b42383449 100644
--- a/targets/SIMU/EXAMPLES/OSD/WEBXML/template_13.xml
+++ b/targets/SIMU/EXAMPLES/OSD/WEBXML/template_13.xml
@@ -46,7 +46,7 @@
   
   <EMULATION_CONFIG>
     <EMULATION_TIME_ms>10000</EMULATION_TIME_ms> <!--if 0 set to infinity--> 
-    <CURVE>disable</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
+    <CURVE>enabled</CURVE> <!-- option: enabled, disabled. If CURVE is enabled, graphes are ploted in real time (UL and DL) of WOD and throughput measurement for each packet -->
    <BACKGROUND_STATS>enable</BACKGROUND_STATS> <!-- option: enable, disable. If enable, it allows to ptrint BACKGROUNS statistics: Nb packets, throughputs,etc-->
     <PERFORMANCE_METRICS>
       	<THROUGHPUT>enable</THROUGHPUT>	<!-- option: enable, disable. If enable, throughput measurements are plotted in real time-->
diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile
index 25d7982a09..3734265b10 100644
--- a/targets/SIMU/USER/Makefile
+++ b/targets/SIMU/USER/Makefile
@@ -228,6 +228,7 @@ OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_config.o
 OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/sinr_sim.o
 OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/cor_SF_sim.o
 OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_functions.o
+OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/event_handler.o
 
 OAISIM_OBJS = $(OPENAIR_TARGETS)/SIMU/USER/oaisim.o
 
diff --git a/targets/SIMU/USER/discrete_event_generator.h b/targets/SIMU/USER/discrete_event_generator.h
deleted file mode 100644
index 0eb5b373dc..0000000000
--- a/targets/SIMU/USER/discrete_event_generator.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "oaisim.h"
-#include "UTIL/FIFO/pad_list.h"
-
-void add_event(struct Event event);
-
-void schedule(enum Event_Type type, int frame, char * key, void* value);
-
-void schedule_end_of_simulation(End_Of_Sim_Event_Type type, int value);
-
-int end_of_simulation();
-
-void update_omg_model(char * key, void * value);
-
-void update_otg_model(char * key, void * value);
diff --git a/targets/SIMU/USER/discrete_event_generator.c b/targets/SIMU/USER/event_handler.c
similarity index 81%
rename from targets/SIMU/USER/discrete_event_generator.c
rename to targets/SIMU/USER/event_handler.c
index 1b9653a362..d7c15e4461 100644
--- a/targets/SIMU/USER/discrete_event_generator.c
+++ b/targets/SIMU/USER/event_handler.c
@@ -1,37 +1,75 @@
-#include "discrete_event_generator.h"
-#include <stdio.h>
-#include <stdlib.h>
+/*******************************************************************************
 
-extern frame_t frame;
-End_Of_Sim_Event end_event; //Could later be a list of condition_events (if the end condition is more complicated)
-Event_List event_list;
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
 
-void add_event(struct Event event) {
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
 
-    Event_elt * counter = event_list.head;
-    Event_elt * previous = counter;
-    Event_elt * elt = malloc(sizeof(Event_elt));
+  This program is distributed in the hope 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.
 
-    while (counter != NULL) {
-        if ((counter->event).frame > event.frame) break;
-        //else if ((counter->event).next_slot > event.next_slot) break;
-        else {
-            previous = counter;
-            counter = counter->next;
-        }
-    }
+  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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+/*! \file event_handler.c
+* \brief event handler primitives
+* \author Navid Nikaein and Mohamed Said MOSLI BOUKSIAA,
+* \date 2014
+* \version 0.5
+* @ingroup _oai
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "event_handler.h"
+
+//extern frame_t frame;
+//End_Of_Sim_Event end_event; //Could later be a list of condition_events (if the end condition is more complicated)
 
-    elt->event = event;
+Event_List_t event_list;
 
-    if (event_list.head != NULL)
-        event_list_add_element(elt, previous, &event_list);
-    else
-        event_list_add_head(elt, &event_list);
+void add_event(Event_t event) {
 
+  Event_elt_t * counter = event_list.head;
+  Event_elt_t * previous = counter;
+  Event_elt_t * elt = malloc(sizeof(Event_elt_t));
+  
+  while (counter != NULL) {
+    if ((counter->event).frame > event.frame) break;
+    //else if ((counter->event).next_slot > event.next_slot) break;
+    else {
+      previous = counter;
+      counter = counter->next;
+    }
+  }
+  
+  elt->event = event;
+  
+  if (event_list.head != NULL)
+    event_list_add_element(elt, previous, &event_list);
+  else
+    event_list_add_head(elt, &event_list);
+  
 }
 
-void schedule(enum Event_Type type, int frame, char * key, void * value) {
-    Event event;
+void schedule(Event_Type_t type, int frame, char * key, void * value) {
+    Event_t event;
     event.frame = frame;
     if (key == NULL) { //Global model update
         event.key = NULL;
@@ -44,25 +82,130 @@ void schedule(enum Event_Type type, int frame, char * key, void * value) {
     add_event(event);
 }
 
-void schedule_end_of_simulation(End_Of_Sim_Event_Type type, int value) {
-    end_event.type = type;
-    end_event.value = value;
-}
+/*
+ * this function can reschedule events in the future to build a desired (more dynamic) scenario 
+ * TODO: make sure that OCG OAI_Emulation is decoupled with the local vars
+ */
+void schedule_events(){
+  
+  /*
+   * Step 1: vars needed for future changes
+   */
+  
+  // overall config associated with OAI_ET
+  // OAI_Emulation * oai_frame_1000; 
+  
+  // specific config
+  /* 
+   * associated with SYS_ET
+   */
+  //Environment_System_Config * system_frame_200;
+  /*
+   * associated with TOPO_ET
+   */
+  //Topology_Config *topology_frame_10;
+  /* 
+   * associated with APP_ET
+   */
+  //Application_Config *application_frame_20;
+  /* 
+   * associated with EMU_ET
+   */
+  //Emulation_Config * emulation_frame_100;
+  
+  
+  /*
+   * Step 2: set the desired future changes in the vars 
+   */
+  // i.e. optionally provide an XML file and update OCG vars
+  
+  //mob_frame_10 -> ...
+  //application_frame_30 -> ...
+
+  /*
+   * Step 3: schedule the execution of changes 
+   */
+
+  // general OAI dynamic configuration
+
+  //schedule(OAI_ET, 1000, NULL, oai_frame_1000);
+  //schedule(SYS_ET, 200, NULL, system_frame_200);
+  //schedule(TOPO_ET, 10, NULL, topology_frame_10);
+  //schedule(APP_ET, 20, NULL, application_frame_20);
+  //schedule(EMU_ET, 100, NULL,emulation_frame_100);
 
-int end_of_simulation() {
-  switch (end_event.type) {
-    case FRAME:
-        if (frame == end_event.value)
-            return 1;
-        break;
+  // protocol dynamic configuration
+  //schedule(MAC_ET, 100, NULL,mac_frame_100);
 
-   /* default:
-      return 0;*/
+
+  //event_list_display(&event_list);
+
+}
+
+void execute_events(frame_t frame){
+  
+  Event_elt_t *user_defined_event;
+  Event_t event;
+ 
+  while ((user_defined_event = event_list_get_head(&event_list)) != NULL) {
+    
+    event = user_defined_event->event;
+    
+    if (event.frame == frame) {
+      switch (event.type) {
+      case OAI_ET:
+	update_oai_model(event.key, event.value); 
+	user_defined_event = event_list_remove_head(&event_list);
+	break;
+	
+      case SYS_ET:
+	update_sys_model(event.key, event.value); 
+	user_defined_event = event_list_remove_head(&event_list);
+	break;
+	    
+      case TOPO_ET:
+	update_topo_model(event.key, event.value); //implement it with assigning the new values to that of oai_emulation & second thing is to ensure mob model is always read from oai_emulation
+	user_defined_event = event_list_remove_head(&event_list);
+	break;
+	
+      case APP_ET:
+	update_app_model(event.key, event.value);
+	user_defined_event = event_list_remove_head(&event_list);
+	break;
+	
+      case EMU_ET:
+	update_emu_model(event.key, event.value); 
+	user_defined_event = event_list_remove_head(&event_list);
+	break;
+	
+      case MAC_ET:
+	update_mac(event.key, event.value); 
+	user_defined_event = event_list_remove_head(&event_list);
+	break;
+	
+      default :
+	break;
+      }
+    } else {
+      break;
     }
-  return 0;
+  }
+  
 }
 
-void update_omg_model(char * key, void * value) {
+void update_mac(char * key, void * value) {
+
+}
+
+void update_oai_model(char * key, void * value) {
+
+}
+
+void update_sys_model(char * key, void * value) {
+
+}
+
+void update_topo_model(char * key, void * value) {
     printf("\n\n\nA NEW MOB MODEL\n\n\n");
 /*
     if (key != NULL) { //Global model update
@@ -127,7 +270,7 @@ void update_omg_model(char * key, void * value) {
     */
 }
 
-void update_otg_model(char * key, void * value) {
+void update_app_model(char * key, void * value) {
     printf("\n\n\nA NEW APP MODEL\n\n\n");
     //int i;
 /*
@@ -329,3 +472,8 @@ void update_otg_model(char * key, void * value) {
     }
     */
 }
+
+void update_emu_model(char * key, void * value) {
+
+}
+
diff --git a/targets/SIMU/USER/event_handler.h b/targets/SIMU/USER/event_handler.h
new file mode 100644
index 0000000000..10f8251bba
--- /dev/null
+++ b/targets/SIMU/USER/event_handler.h
@@ -0,0 +1,67 @@
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+/*! \file event_handler.h
+* \brief primitives to handle event acting on oai
+* \author Navid Nikaein and Mohamed Said MOSLI BOUKSIAA,
+* \date 2014
+* \version 0.5
+* @ingroup _oai
+*/
+
+#include "oaisim.h"
+#include "UTIL/FIFO/pad_list.h"
+
+
+
+void add_event(Event_t event);
+
+void schedule(Event_Type_t type, int frame, char * key, void* value);
+
+void schedule_events(void);
+
+void execute_events(frame_t frame);
+
+
+void update_oai_model(char * key, void * value);
+
+void update_sys_model(char * key, void * value);
+
+void update_topo_model(char * key, void * value);
+
+void update_app_model(char * key, void * value);
+
+void update_emu_model(char * key, void * value);
+
+void update_mac(char * key, void * value);
+
+/*
+void schedule_end_of_simulation(End_Of_Sim_Event_Type type, int value);
+
+int end_of_simulation();
+*/
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 0799e345be..baaefdedac 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -1,3 +1,32 @@
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
 #include <string.h>
 #include <math.h>
 #include <unistd.h>
@@ -8,6 +37,7 @@
 #include <cblas.h>
 #include <execinfo.h>
 
+#include "event_handler.h"
 #include "SIMULATION/RF/defs.h"
 #include "PHY/types.h"
 #include "PHY/defs.h"
@@ -556,7 +586,11 @@ void *l2l1_task(void *args_p) {
           }
       } while(message_p != NULL);
 #endif
-
+      
+      //Run the aperiodic user-defined events
+      if (oai_emulation.info.oeh_enabled == 1)
+	execute_events(frame);
+           
       /*
      // Handling the cooperation Flag
      if (cooperation_flag == 2)
@@ -1075,6 +1109,10 @@ int main(int argc, char **argv) {
   smbv_init_config(smbv_fname, smbv_nframes);
   smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0]->lte_frame_parms);
 #endif
+  // add events to future event list: Currently not used
+  if (oai_emulation.info.oeh_enabled == 1)
+    schedule_events();
+
   // oai performance profiler is enabled 
   if (oai_emulation.info.opp_enabled == 1)
     reset_opp_meas();
diff --git a/targets/SIMU/USER/oaisim.h b/targets/SIMU/USER/oaisim.h
index c78d6a7888..1dde3d2360 100644
--- a/targets/SIMU/USER/oaisim.h
+++ b/targets/SIMU/USER/oaisim.h
@@ -26,7 +26,7 @@ void do_DL_sig(double **r_re0,double **r_im0,double **r_re,double **r_im,double
 void init_ue(node_desc_t  *ue_data, UE_Antenna ue_ant);//Abstraction changes
 void init_enb(node_desc_t  *enb_data, eNB_Antenna enb_ant);//Abstraction changes
 void extract_position(Node_list input_node_list, node_desc_t**, int nb_nodes);//Abstraction changes
-void get_beta_map();//Abstraction changes
+void get_beta_map(void);//Abstraction changes
 void get_MIESM_param(void);
 
 void init_snr(channel_desc_t *,  node_desc_t *, node_desc_t *, double*, double*, uint8_t, uint16_t, uint8_t);//Abstraction changes
@@ -42,13 +42,12 @@ void calc_path_loss(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *
 
 void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, frame_t frame, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
 
-#ifdef OPENAIR2
-int omv_write (int pfd,  Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data);
-void omv_end (int pfd, Data_Flow_Unit omv_data);
-
 void reset_opp_meas(void);
 void print_opp_meas(void);
 
+#ifdef OPENAIR2
+int omv_write (int pfd,  Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data);
+void omv_end (int pfd, Data_Flow_Unit omv_data);
 #endif
 
 
diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c
index 4b38d65867..274de50f02 100644
--- a/targets/SIMU/USER/oaisim_config.c
+++ b/targets/SIMU/USER/oaisim_config.c
@@ -1,3 +1,43 @@
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
+/*! \file oaisim_config.c
+* \brief Configuration of oaisim
+* \author Navid Nikaein & Andre Gomes (One source)
+* \date 2014
+* \version 1.0
+* \company Eurecom
+* \email: openair_tech@eurecom.fr
+* \note
+* \warning
+*/
+
 #include <string.h>
 #include <math.h>
 #include <unistd.h>
@@ -165,7 +205,7 @@ mapping packet_gen_names[] =
     {NULL, -1}
 };
 
-void init_oai_emulation() {
+void init_oai_emulation(void) {
 
   int i;
 
@@ -195,7 +235,6 @@ void init_oai_emulation() {
 	oai_emulation.environment_system_config.system_bandwidth_MB = 7.68;
 	oai_emulation.environment_system_config.system_frequency_GHz = 1.9;
 
-
 	oai_emulation.topology_config.area.x_m = 500;
 	oai_emulation.topology_config.area.y_m = 500;
 	oai_emulation.topology_config.network_type.selected_option = "homogeneous";
@@ -218,6 +257,8 @@ void init_oai_emulation() {
 	oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms = 10.0;
 	oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = "STATIC";
 	oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = "random";
+  oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x = 1;
+  oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y = 1;
 	oai_emulation.topology_config.mobility.eNB_mobility.random_eNB_distribution.number_of_cells = 1;
 	oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.number_of_cells = 1;
 	oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.inter_eNB_distance_km = 1;
@@ -338,6 +379,7 @@ void init_oai_emulation() {
   oai_emulation.info.omv_enabled =0; // v flag
   oai_emulation.info.vcd_enabled=0;
   oai_emulation.info.opp_enabled=0;
+  oai_emulation.info.oeh_enabled=0;
 
   oai_emulation.info.cba_group_active=0;
   oai_emulation.info.eMBMS_active_state=0;
@@ -392,7 +434,7 @@ void init_oai_emulation() {
 }
 
 
-void oaisim_config() {
+void oaisim_config(void) {
 
   // init log gen first
  //initialize the log generator
@@ -436,7 +478,7 @@ void oaisim_config() {
   }
 }
 
-int olg_config() {
+int olg_config(void) {
   int comp;
   int ocg_log_level     = map_str_to_int(log_level_names,     oai_emulation.emulation_config.log_emu.level);
   int ocg_log_verbosity = map_str_to_int(log_verbosity_names, oai_emulation.emulation_config.log_emu.verbosity);
@@ -510,7 +552,7 @@ int olg_config() {
   return 1;
 }
 
-int ocg_config_env() {
+int ocg_config_env(void) {
 // int func related to channel desc from oaisim.c could be moved here
 
   if (oai_emulation.info.ocg_enabled){
@@ -531,7 +573,7 @@ int ocg_config_env() {
   }
   return 1;
 }
-int ocg_config_topo() {
+int ocg_config_topo(void) {
 
 	// omg
 	init_omg_global_params();
@@ -571,8 +613,13 @@ int ocg_config_topo() {
 	  LOG_I(OMG,"TRACE file at %s\n", omg_param_list.mobility_file);
 	}
 
-	omg_param_list.mobility_type = oai_emulation.info.omg_model_enb;
+	omg_param_list.mobility_type = oai_emulation.info.omg_model_enb; 
 	omg_param_list.nodes_type = eNB;  //eNB or eNB + RN
+  if (strcmp(oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option, "fixed") == 0) {
+    omg_param_list.user_fixed = true;
+    omg_param_list.fixed_X = (double)oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x;
+    omg_param_list.fixed_Y = (double)oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y;
+  }
 	omg_param_list.nodes = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_rn_local;
  	omg_param_list.seed = oai_emulation.info.seed; // specific seed for enb and ue to avoid node overlapping
 
@@ -1057,7 +1104,7 @@ g_otg->application_idx[source_id_index][destination_id_index]+=1;
 
 
 
-int ocg_config_emu(){
+int ocg_config_emu(void){
 
   if (oai_emulation.emulation_config.emulation_time_ms != 0) {
     oai_emulation.info.n_frames  =  (int) oai_emulation.emulation_config.emulation_time_ms / 10; // configure the number of frame
@@ -1083,6 +1130,9 @@ int ocg_config_emu(){
 	  oai_emulation.info.cli_start_ue[0]);
   }
 
+  if (oai_emulation.info.opp_enabled)
+    opp_enabled = 1;
+
   //bin/LOG_I(OCG, "OPT output file directory = %s\n", oai_emulation.info.output_path);
   oai_emulation.info.opt_enabled = ( oai_emulation.emulation_config.packet_trace.enabled == 0) ? oai_emulation.info.opt_enabled :  oai_emulation.emulation_config.packet_trace.enabled;
   if (oai_emulation.info.opt_enabled == 1) {
diff --git a/targets/SIMU/USER/oaisim_config.h b/targets/SIMU/USER/oaisim_config.h
index cff50ccc8d..aae6d8ba80 100644
--- a/targets/SIMU/USER/oaisim_config.h
+++ b/targets/SIMU/USER/oaisim_config.h
@@ -30,11 +30,11 @@
 
 /*! \file oaisim_config.h
 * \brief configure an emulation
-* \author Lusheng Wang
+* \author navid nikaein & Lusheng Wang
 * \date 2006-2010
 * \version 4.0 
 * \company Eurecom
-* \email: wangl@eurecom.fr
+* \email: openair_tech@eurecom.fr
 * \note this a note 
 * \bug 	this is a bug
 * \warning  this is a warning
@@ -59,19 +59,20 @@ The current sturcture of oaisim is shown by the figure.
 #include "UTIL/OMG/omg.h"
 #include "UTIL/CLI/cli_if.h"
 #include "SIMULATION/ETH_TRANSPORT/defs.h"
+#include "PHY/defs.h"
 
 /** @defgroup _init_oai Initial oaisim
  *  @ingroup _fn
  *  @brief Initialize all the parameters before start an emulation
  * @{*/ 
-	void init_oai_emulation();
+	void init_oai_emulation(void);
 /* @}*/
 
 /** @defgroup _config_oaisim All the configurations for an emulation
  *  @ingroup _fn
  *  @brief This is the function that calls all the other configuration functions
  * @{*/ 
-void oaisim_config();
+void oaisim_config(void);
 /* @}*/
 
 
@@ -79,11 +80,11 @@ void oaisim_config();
  *  @ingroup _fn
  *  @brief There are the functions to configure different various modules in the emulator
  * @{*/ 
-int olg_config();
-int ocg_config_env();
-int ocg_config_omg();
-int ocg_config_topo();
-int ocg_config_app();
-int ocg_config_emu();
+int olg_config(void);
+int ocg_config_env(void);
+int ocg_config_omg(void);
+int ocg_config_topo(void);
+int ocg_config_app(void);
+int ocg_config_emu(void);
 /* @}*/
 
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index e99cbced88..b6e5f58549 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -1,3 +1,33 @@
+/*******************************************************************************
+
+  Eurecom OpenAirInterface
+  Copyright(c) 1999 - 2014 Eurecom
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information
+  Openair Admin: openair_admin@eurecom.fr
+  Openair Tech : openair_tech@eurecom.fr
+  Forums       : http://forums.eurecom.fsr/openairinterface
+  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
+
+*******************************************************************************/
+
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -137,6 +167,7 @@ void get_simulation_options(int argc, char *argv[]) {
 
     LONG_OPTION_PDNC_PERIOD,
     LONG_OPTION_OMG_PERIOD,
+    LONG_OPTION_OEH_ENABLED,
 
     LONG_OPTION_ENB_RAL_LISTENING_PORT,
     LONG_OPTION_ENB_RAL_IP_ADDRESS,
@@ -160,8 +191,9 @@ void get_simulation_options(int argc, char *argv[]) {
   static struct option long_options[] = {
       {"enb-conf",               required_argument, 0, LONG_OPTION_ENB_CONF},
 
-      {"pdcp_period",            required_argument, 0, LONG_OPTION_PDNC_PERIOD},
-      {"omg_period",             required_argument, 0, LONG_OPTION_OMG_PERIOD},
+      {"pdcp-period",            required_argument, 0, LONG_OPTION_PDNC_PERIOD},
+      {"omg-period",             required_argument, 0, LONG_OPTION_OMG_PERIOD},
+      {"oeh-enabled",            no_argument, 0, LONG_OPTION_OEH_ENABLED},
 
       {"enb-ral-listening-port", required_argument, 0, LONG_OPTION_ENB_RAL_LISTENING_PORT},
       {"enb-ral-ip-address",     required_argument, 0, LONG_OPTION_ENB_RAL_IP_ADDRESS},
@@ -180,6 +212,7 @@ void get_simulation_options(int argc, char *argv[]) {
       {"ue-mihf-remote-port",    required_argument, 0, LONG_OPTION_UE_MIHF_REMOTE_PORT},
       {"ue-mihf-ip-address",     required_argument, 0, LONG_OPTION_UE_MIHF_IP_ADDRESS},
       {"ue-mihf-id",             required_argument, 0, LONG_OPTION_UE_MIHF_ID},
+
       {NULL, 0, NULL, 0}
   };
 
@@ -205,7 +238,10 @@ void get_simulation_options(int argc, char *argv[]) {
             printf("OMG period is %d\n", omg_period);
         }
         break;
-
+      
+      case LONG_OPTION_OEH_ENABLED:
+	oai_emulation.info.oeh_enabled = 1;
+	break;
 #if defined(ENABLE_RAL)
       case LONG_OPTION_ENB_RAL_LISTENING_PORT:
         if (optarg) {
@@ -475,11 +511,11 @@ void get_simulation_options(int argc, char *argv[]) {
         }
         oai_emulation.info.opt_mode = opt_type;
         break;
-    case 'q':
-      // openair performane profiler 
-      oai_emulation.info.opp_enabled = 1; // this var is used for OCG
-      opp_enabled = 1; // this is the global var used by oaisim 
-      break;
+      case 'q':
+        // openair performane profiler 
+        oai_emulation.info.opp_enabled = 1; // this var is used for OCG
+        opp_enabled = 1; // this is the global var used by oaisim 
+        break;
       case 'Q':
         //eMBMS_active=1;
         // 0 : not used (default), 1: eMBMS and RRC enabled, 2: eMBMS relaying and RRC enabled, 3: eMBMS enabled, RRC disabled, 4: eMBMS relaying enabled, RRC disabled
@@ -512,7 +548,7 @@ void get_simulation_options(int argc, char *argv[]) {
         break;
 
       case 't':
-	target_ul_mcs = atoi (optarg);
+        target_ul_mcs = atoi (optarg);
         break;
 
       case 'T':
-- 
GitLab