From ee0bc07beb58fc6638bff63cf003d1bd110c2a2d Mon Sep 17 00:00:00 2001
From: winckel <winckel@eurecom.fr>
Date: Thu, 31 Oct 2013 17:58:50 +0000
Subject: [PATCH] Restored -K option in oaisim. Fixed some warnings.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4313 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair2/UTIL/OTG/otg_tx.c           | 10 ++++------
 openair2/UTIL/OTG/otg_tx.h           |  2 +-
 targets/SIMU/USER/oaisim_functions.c |  5 +++--
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/openair2/UTIL/OTG/otg_tx.c b/openair2/UTIL/OTG/otg_tx.c
index 4b34734640..2aaf7693f7 100644
--- a/openair2/UTIL/OTG/otg_tx.c
+++ b/openair2/UTIL/OTG/otg_tx.c
@@ -201,7 +201,7 @@ int adjust_size(int size){
 
 
 
-unsigned char *packet_gen(int src, int dst, int app, int ctime, int * pkt_size){ // when pdcp, ctime = frame cnt
+unsigned char *packet_gen(int src, int dst, int app, int ctime, unsigned int * pkt_size){ // when pdcp, ctime = frame cnt
 
   //unsigned char *packet=NULL;
   unsigned int size=0;
@@ -212,7 +212,7 @@ unsigned char *packet_gen(int src, int dst, int app, int ctime, int * pkt_size){
   unsigned int flag;
   char *payload=NULL;
   char *header=NULL;
-  int header_size;
+  int header_size = 0;
 
    
   // check if the app is configured
@@ -242,7 +242,7 @@ Send Packets when:
       header = random_string(otg_info->header_size[src][dst], g_otg->packet_gen_type, HEADER_ALPHABET);
       header_size = (header != NULL)? strlen(header) : 0;
       payload = random_string(size, RANDOM_STRING, PAYLOAD_ALPHABET);
-      if (payload == NULL) return;
+      if (payload == NULL) return NULL;
       flag=0xffff;
   	flow=otg_info->flow_id[src][dst];
   	seq_num=otg_info->seq_num[src][dst][otg_info->traffic_type[src][dst]];
@@ -501,8 +501,6 @@ unsigned int get_application_state(int src, int dst, int application, int ctime)
 void header_size_gen(int src, int dst, int application){
 
 unsigned int size_header=0;
-unsigned int type_header=0;
- 
 
  if (otg_info->header_size_app[src][dst][application]==0)
    {
@@ -632,7 +630,7 @@ unsigned char * serialize_buffer(char* header, char* payload, unsigned int buffe
   if (header == NULL || payload == NULL)
     return NULL;
   // allocate memory for the tx_buffer
-  tx_buffer= (char*)malloc(buffer_size);
+  tx_buffer= (unsigned char*)malloc(buffer_size);
   // add otg control information first for decoding and computing the statistics 
   otg_hdr_info_p = (otg_hdr_info_t *) (&tx_buffer[byte_tx_count]);
   otg_hdr_info_p->size = buffer_size;
diff --git a/openair2/UTIL/OTG/otg_tx.h b/openair2/UTIL/OTG/otg_tx.h
index faf9e05a76..6642c5f522 100644
--- a/openair2/UTIL/OTG/otg_tx.h
+++ b/openair2/UTIL/OTG/otg_tx.h
@@ -94,7 +94,7 @@ char * random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
 * \note 
 * @ingroup  _otg
 */
-unsigned char *packet_gen(int src, int dst, int app, int ctime, int *pkt_size);
+unsigned char *packet_gen(int src, int dst, int app, int ctime, unsigned int *pkt_size);
 
 
 /*! \fn char *header_gen(int  hdr_size);
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index c349e2fbda..98c4b59784 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -24,6 +24,7 @@
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 #include "UTIL/OTG/otg_config.h"
+#include "UTIL/OTG/otg_tx.h"
 
 #include "cor_SF_sim.h"
 
@@ -114,7 +115,7 @@ void get_simulation_options(int argc, char *argv[]) {
     {NULL, 0, NULL, 0}
   };
 
-  while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hHi:IJ:j:k:l:L:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vVw:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) {
+  while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hHi:IJ:j:k:K:l:L:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vVw:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) {
     switch (c) {
     case 0:
       if (! strcmp(long_options[option_index].name, "pdcp_period")) {
@@ -958,7 +959,7 @@ void update_otg_UE(int UE_id, unsigned int ctime) {
       if (mac_get_rrc_status(UE_id, 0/*eNB_flag*/, dst_id ) > 2 /*RRC_CONNECTED*/) {
 	Packet_otg_elt *otg_pkt = malloc (sizeof(Packet_otg_elt));
 	// Manage to add this packet to the tail of your list
-	(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen(src_id, dst_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
+	(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen(src_id, dst_id, 0, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
 
 	if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
 	  (otg_pkt->otg_pkt).rb_id = dst_id * NB_RB_MAX + DTCH;
-- 
GitLab