* apply patches

* test pre-ci passed


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6498 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Navid Nikaein
2015-02-09 22:15:24 +00:00
parent 0e7d1371bb
commit 57d7c10fdc
26 changed files with 307 additions and 221 deletions
+7 -3
View File
@@ -217,9 +217,13 @@ int OCG_main(char is_local_server[FILENAME_LENGTH_MAX]) {
case STATE_GENERATE_REPORT :
if (create_dir_OK != MODULE_OK) {
// a temp folder is required when the output folder could not be correctly generated
strcpy(output_dir, OPENAIR_TARGETS);
strcat(output_dir, "SIMU/EXAMPLES/OSD/");
strcat(output_dir, TEMP_OUTPUT_DIR);
//strcpy(output_dir, OPENAIR_TARGETS);
//strcat(output_dir, "SIMU/EXAMPLES/OSD/");
//strcat(output_dir, TEMP_OUTPUT_DIR);
strncpy(output_dir, OPENAIR_TARGETS, sizeof(output_dir));
output_dir[sizeof(output_dir) - 1] = 0; // terminate string
strncat(output_dir, "SIMU/EXAMPLES/OSD/", sizeof(output_dir) - strlen(output_dir) - 1);
strncat(output_dir, TEMP_OUTPUT_DIR, sizeof(output_dir) - strlen(output_dir) - 1);
struct stat st;
if(stat(output_dir, &st) != 0) { // if temp output directory does not exist, we create it here
mkdir(output_dir, S_IRWXU | S_IRWXG | S_IRWXO);
+11 -6
View File
@@ -52,21 +52,26 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M
char directory[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
mode_t process_mask = umask(0);
strcpy(directory, output_dir);
//strcpy(directory, output_dir);
strncpy(directory, output_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX);
directory[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - 1] = 0; // terminate string
struct stat st;
if(stat(directory, &st) != 0) { // if output_dir does not exist, we create it here
mkdir(directory, S_IRWXU | S_IRWXG | S_IRWXO);
LOG_I(OCG, "output_dir %s is created", directory);
}
strcat(directory, user_name);
//strcat(directory, user_name);
strncat(directory, user_name, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(directory) - 1);
mkdir(directory, S_IRWXU | S_IRWXG | S_IRWXO);
strcat(directory, "/");
strcat(directory, file_date);
// strcat(directory, "/");
//strcat(directory, file_date);
strncat(directory, "/", FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(directory) - 1);
strncat(directory, file_date, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(directory) - 1);
mkdir(directory, S_IRWXU | S_IRWXG |S_IRWXO);
//char directory_extension[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 64] = "";
+5 -2
View File
@@ -92,8 +92,11 @@ int detect_file(char src_dir[DIR_LENGTH_MAX], char is_local_server[FILENAME_LENG
}
char check_src_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX];
strcpy(check_src_file, src_dir);
strcat(check_src_file, filename);
//strcpy(check_src_file, src_dir);
//strcat(check_src_file, filename);
strncpy(check_src_file, src_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX);
check_src_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - 1] = 0; // terminate string
strncat(check_src_file, filename, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(check_src_file) - 1);
struct stat st;
if(stat(check_src_file, &st) != 0) {
LOG_E(OCG, "file %s does not exist\n", check_src_file);
+5 -3
View File
@@ -54,9 +54,11 @@ int generate_report(char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_
// for the xml writer, refer to http://xmlsoft.org/html/libxml-xmlwriter.html
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
strcat(dst_file, dst_dir);
strcat(dst_file, filename);
//strcat(dst_file, dst_dir);
//strcat(dst_file, filename);
strncat(dst_file, dst_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(dst_file) - 1);
strncat(dst_file, filename, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(dst_file) - 1);
xmlTextWriterPtr writer;
writer = xmlNewTextWriterFilename(dst_file, 0);
+11 -9
View File
@@ -1249,15 +1249,17 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
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;
// if (strcmp(strndup(ch, len), "wireshark") == 0) {
if (strncmp(ch, "wireshark", len) == 0) {
opt_type = OPT_WIRESHARK;
// } else if (strcmp(strndup(ch, len), "pcap") == 0) {
} else if (strncmp(ch, "pcap", len) == 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_) {
+30 -23
View File
@@ -48,27 +48,34 @@
/*----------------------------------------------------------------------------*/
int parse_filename(char filename[FILENAME_LENGTH_MAX]) {
char *delim = "._";
//char *result;
char tmp_filename[FILENAME_LENGTH_MAX];
char *fd_tmp;
char *un_tmp;
char *ex_tmp;
//delim = "._";
strcpy(tmp_filename, filename);
un_tmp = strtok(tmp_filename, delim);
fd_tmp = strtok(NULL, delim);
ex_tmp = strtok(NULL, delim);
if ((ex_tmp == NULL) || ((strcmp(ex_tmp, "xml")) && (strcmp(ex_tmp, "XML")))) {
LOG_E(OCG, "Please use .xml file for configuration with the format \"user_name.file_date.xml\"\nfile_date = \"year month day hour minute second\" without space, \ne.g. 20100201193045 represents in the year 2010, February 1st, 19:30:45\n");
return MODULE_ERROR;
} else {
strcpy(file_date, fd_tmp);
strcpy(user_name, un_tmp);
LOG_I(OCG, "File name is parsed as user_name = %s, file_date = %s\n", user_name, file_date);
return MODULE_OK;
}
char *delim = "._";
//char *result;
char tmp_filename[FILENAME_LENGTH_MAX];
char *fd_tmp;
char *un_tmp;
char *ex_tmp;
//delim = "._";
// strcpy(tmp_filename, filename);
strncpy(tmp_filename, filename, FILENAME_LENGTH_MAX);
tmp_filename[FILENAME_LENGTH_MAX - 1] = 0; // terminate string
un_tmp = strtok(tmp_filename, delim);
fd_tmp = strtok(NULL, delim);
ex_tmp = strtok(NULL, delim);
if ((ex_tmp == NULL) || ((strcmp(ex_tmp, "xml")) && (strcmp(ex_tmp, "XML")))) {
LOG_E(OCG, "Please use .xml file for configuration with the format \"user_name.file_date.xml\"\nfile_date = \"year month day hour minute second\" without space, \ne.g. 20100201193045 represents in the year 2010, February 1st, 19:30:45\n");
return MODULE_ERROR;
} else {
//strcpy(file_date, fd_tmp);
//strcpy(user_name, un_tmp);
strncpy(file_date, fd_tmp, sizeof(file_date));
file_date[sizeof(file_date) - 1] = 0; // terminate string
strncpy(user_name, un_tmp, sizeof(user_name));
user_name[sizeof(user_name) - 1] = 0; // terminate string
LOG_I(OCG, "File name is parsed as user_name = %s, file_date = %s\n", user_name, file_date);
return MODULE_OK;
}
}
+36 -28
View File
@@ -49,32 +49,40 @@
//int save_XML(int copy_or_move, char src_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX], char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_MAX]) {
int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename) {
FILE *fs, *ft;
char ch;
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
char XML_saving_dir[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
strcpy(dst_file, output_dir);
//strcat(dst_file, "SCENARIO/XML/");
strcpy(XML_saving_dir, dst_file);
strcat(dst_file, filename);
fs = fopen(src_file, "r");
ft = fopen(dst_file, "w");
if ((ft !=NULL)&&(fs!=NULL)){
while(1) {
ch = getc(fs);
if(ch == EOF) {
break;
} else {
putc(ch, ft);
}
}
fclose(fs);
fclose(ft);
}
if (copy_or_move == 2) remove(src_file);
LOG_I(OCG, "The file is saved in directory \"%s\"\n", XML_saving_dir);
return MODULE_OK;
FILE *fs, *ft;
int ch;
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
char XML_saving_dir[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
//strcpy(dst_file, output_dir);
strncpy(dst_file, output_dir, sizeof(dst_file));
dst_file[sizeof(dst_file) - 1] = 0; // terminate string
//strcat(dst_file, "SCENARIO/XML/");
//strcpy(XML_saving_dir, dst_file);
//strcat(dst_file, filename);
strncpy(XML_saving_dir, dst_file, sizeof(XML_saving_dir));
XML_saving_dir[sizeof(XML_saving_dir) - 1] = 0; // terminate string
strncat(dst_file, filename, sizeof(dst_file) - strlen(dst_file) - 1);
fs = fopen(src_file, "r");
ft = fopen(dst_file, "w");
if ((ft !=NULL)&&(fs!=NULL)){
while(1) {
ch = getc(fs);
if(ch == EOF) {
break;
} else {
putc(ch, ft);
}
}
}
if (fs)
fclose(fs);
if (ft)
fclose(ft);
if (copy_or_move == 2) remove(src_file);
LOG_I(OCG, "The file is saved in directory \"%s\"\n", XML_saving_dir);
return MODULE_OK;
}
+5 -1
View File
@@ -164,6 +164,7 @@ void processSubscriptions() {
continue;
}
}
free( objID );
}
}
@@ -211,7 +212,8 @@ int extractCommandStatus(storage *s, unsigned char commandId, char * description
description = readString();
// print description if needed
free( description );
description = 0;
//free actual message content
//depends on the message which is handled
@@ -325,6 +327,8 @@ void commandGetVehicleVariable(char *vehID, int varID)// malloc for vehID and va
UNUSED_VARIABLE(rs);
UNUSED_VARIABLE(valueDataType);
UNUSED_VARIABLE(domID);
free( rs );
}
}
+8 -1
View File
@@ -118,6 +118,7 @@ void sendExact(int cmdLength){
buf +=n;
}
freeStorage(storageStart);
free(buf);
}
@@ -147,6 +148,9 @@ storage * receiveExact(){
// create storage to access the content
tracker = writePacket(bufLength, 4);
free( bufLength );
bufLength = 0;
// store pointer to free the space later
// storage *freeTracker = tracker;
int s= readInt();
@@ -184,7 +188,10 @@ storage * receiveExact(){
bytesRead += readThisTime;
}
return writePacket(buf, NN);
storage* temp = writePacket(buf, NN);
free( buf );
return temp;
//return writePacket(buf, NN);
}
+12 -5
View File
@@ -211,7 +211,8 @@ update_IDs (void)
if (tmp_departed->string != NULL)
{
char *tmp_string = malloc (sizeof (strlen (tmp_departed->string)));
// char *tmp_string = malloc (sizeof (strlen (tmp_departed->string)));
char *tmp_string = malloc( strlen(tmp_departed->string) + 1 );
strcpy (tmp_string, tmp_departed->string);
//printf("OMG - 2 head is not null and value is: %s\n",tmp_string);
int OAI_ID = get_oaiID_by_SUMO (tmp_string, id_manager);
@@ -221,16 +222,19 @@ update_IDs (void)
{
// printf("Reached the Maximum of OAI nodes to be mapped to SUMO\n");
// LOG_I(OMG, "Reached the Maximum of OAI nodes to be mapped to SUMO\n");
free( tmp_string );
return; // stopping mapping as the maximum of OAI nodes has been reached;
}
}
free( tmp_string );
}
while (tmp_departed->next != NULL)
{
// printf("OMG - 2 main is not null \n");
//char tmp_string [strlen(tmp_departed->string)];
char *tmp_string = malloc (sizeof (strlen (tmp_departed->string)));
//char *tmp_string = malloc (sizeof (strlen (tmp_departed->string)));
char *tmp_string = malloc( strlen(tmp_departed->string) + 1 );
strcpy (tmp_string, tmp_departed->string);
//char *tmp_string = tmp_departed->string;
int OAI_ID = get_oaiID_by_SUMO (tmp_string, id_manager);
@@ -240,9 +244,11 @@ update_IDs (void)
{
//printf("Reached the Maximum of OAI nodes to be mapped to SUMO\n");
//LOG_I(OMG, "Reached the Maximum of OAI nodes to be mapped to SUMO\n");
free( tmp_string );
return; // stopping mapping as the maximum of OAI nodes has been reached;
}
}
free( tmp_string );
tmp_departed = tmp_departed->next;
}
@@ -324,8 +330,7 @@ activate_and_map (char *sumo_id)
LOG_I (OMG, "activating node %s \n", sumo_id);
#endif
// TODO: So far, only UE can be SUMO mobile, but could change
node_struct *active_node =
get_first_inactive_OAI_node (node_vector[SUMO], UE);
node_struct *active_node = get_first_inactive_OAI_node (node_vector[SUMO], UE);
if (active_node != NULL)
{ // found an inactive OAI node; will be mapped to SUMO
active_node->mobile = 1; // now node is active in SUMO
@@ -333,7 +338,8 @@ activate_and_map (char *sumo_id)
active_nodes = add_entry (active_node, active_nodes);
map->oai_id = active_node->id;
map->sumo_id = malloc (sizeof ((int) strlen (sumo_id)));
// map->sumo_id = malloc (sizeof ((int) strlen (sumo_id)));
map->sumo_id = malloc( strlen(sumo_id) + 1 );
strcpy (map->sumo_id, sumo_id);
#ifdef STANDALONE
@@ -345,6 +351,7 @@ activate_and_map (char *sumo_id)
#endif
// TODO fusion the two lists...leads to data inconsistency
// FIXME adding the same memory region to two lists => crash at free() time
id_manager->map_sumo2oai =
add_map_entry (map, id_manager->map_sumo2oai);
+19 -9
View File
@@ -394,7 +394,9 @@ fc=fopen("/tmp/otg.log","w");;
LOG_E(OTG,"(src=%d, dst=%d, appli %d) : Unknown traffic \n ", i, j,k);
strcpy(traffic,"UKNOWN TRAFFIC");
} else {
strcpy (traffic, map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]));
//strcpy (traffic, map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]));
strncpy (traffic, map_int_to_str(otg_app_type_names,g_otg->application_type[i][j][k]), sizeof(traffic));
traffic[sizeof(traffic) - 1] = 0; // terminate string
}
@@ -633,8 +635,10 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){
LOG_I(OTG,"[DATA] OWD MAX (one way)ms= %.2f \n", max_owd_dl);
LOG_I(OTG,"[DATA] Estimated E2E OWD MIN (one way)ms= %.2f \n", min_owd_dl_e2e);
LOG_I(OTG,"[DATA] Estimated E2E OWD MAX (one way)ms= %.2f \n", max_owd_dl_e2e);
LOG_I(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_dl/(float)num_active_source );
LOG_I(OTG,"[DATA] Estimated E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_dl_e2e/(float)num_active_source );
if (num_active_source != 0) {
LOG_I(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_dl/(float)num_active_source );
LOG_I(OTG,"[DATA] Estimated E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_dl_e2e/(float)num_active_source );
}
LOG_I(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_dl*1000*8)/(otg_info->ctime*1024));
LOG_I(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_dl*1000*8)/(otg_info->ctime*1024));
LOG_I(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_dl - rx_total_pkts_dl);
@@ -671,8 +675,10 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){
LOG_F(OTG,"[DATA] OWD MAX (one way)ms= %.2f \n", max_owd_dl);
LOG_F(OTG,"[DATA] ESTIMATED E2E OWD MIN (one way)ms= %.2f \n", min_owd_dl_e2e);
LOG_F(OTG,"[DATA] ESTIMATED E2E OWD MAX (one way)ms= %.2f \n", max_owd_dl_e2e);
LOG_F(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_dl/(float)num_active_source);
LOG_F(OTG,"[DATA] ESTIMATED E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_dl_e2e/(float)num_active_source);
if (num_active_source != 0) {
LOG_F(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_dl/(float)num_active_source);
LOG_F(OTG,"[DATA] ESTIMATED E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_dl_e2e/(float)num_active_source);
}
LOG_F(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_dl*1000*8)/(otg_info->ctime*1024));
LOG_F(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_dl*1000*8)/(otg_info->ctime*1024));
LOG_F(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_dl - rx_total_pkts_dl );
@@ -705,8 +711,10 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){
LOG_I(OTG,"[DATA] OWD MAX (one way)ms= %.2f \n", max_owd_ul);
LOG_I(OTG,"[DATA] ESTIMATED E2E OWD MIN (one way)ms= %.2f \n", min_owd_ul_e2e);
LOG_I(OTG,"[DATA] ESTIMATED E2E OWD MAX (one way)ms= %.2f \n", max_owd_ul_e2e);
LOG_I(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_ul_e2e/(float)num_active_source);
LOG_I(OTG,"[DATA] ESTIMATED E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_ul/(float)num_active_source);
if (num_active_source != 0) {
LOG_I(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_ul_e2e/(float)num_active_source);
LOG_I(OTG,"[DATA] ESTIMATED E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_ul/(float)num_active_source);
}
LOG_I(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_ul*1000*8)/(otg_info->ctime*1024));
LOG_I(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_ul*1000*8)/(otg_info->ctime*1024));
LOG_I(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_ul - rx_total_pkts_ul );
@@ -733,8 +741,10 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){
LOG_F(OTG,"[DATA] OWD MAX (one way)ms= %.2f \n", max_owd_ul);
LOG_F(OTG,"[DATA] ESTIMATED E2E OWD MIN (one way)ms= %.2f \n", min_owd_ul_e2e);
LOG_F(OTG,"[DATA] ESTIMATED E2E OWD MAX (one way)ms= %.2f \n", max_owd_ul_e2e);
LOG_F(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_ul/(float)num_active_source);
LOG_F(OTG,"[DATA] ESTIMATED E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_ul_e2e/(float)num_active_source);
if (num_active_source != 0) {
LOG_F(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_ul/(float)num_active_source);
LOG_F(OTG,"[DATA] ESTIMATED E2E JITTER AVG ms= %lf \n", otg_info->average_jitter_ul_e2e/(float)num_active_source);
}
LOG_F(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_ul*1000*8)/(otg_info->ctime*1024));
LOG_F(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_ul*1000*8)/(otg_info->ctime*1024));
LOG_F(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_ul - rx_total_pkts_ul );
+1 -1
View File
@@ -1406,7 +1406,7 @@ break;
g_otg->trans_proto[i][j][k] = TCP;
g_otg->ip_v[i][j][k] = IPV4;
g_otg->idt_dist[i][j][k][PE_STATE] = UNIFORM;
g_otg->idt_lambda[i][j][k][PE_STATE] = 1/40;
g_otg->idt_lambda[i][j][k][PE_STATE] = 1.0/40.0;
g_otg->idt_min[i][j][k][PE_STATE] = 40;
g_otg->idt_max[i][j][k][PE_STATE] = 80;
g_otg->size_dist[i][j][k][PE_STATE] = BACKGROUND_DIST;