Commit 57d7c10f authored by Navid Nikaein's avatar Navid Nikaein

* apply patches

* test pre-ci passed


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6498 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0e7d1371
...@@ -688,7 +688,7 @@ int32_t generate_prach(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, ...@@ -688,7 +688,7 @@ int32_t generate_prach(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,
memcpy((void*)prach,(void*)(prach+36864),Ncp<<2); memcpy((void*)prach,(void*)(prach+36864),Ncp<<2);
prach_len = 18432+Ncp; prach_len = 18432+Ncp;
if (prach_fmt>1) { if (prach_fmt>1) {
memcpy((void*)(prach2+36834),(void*)prach2,73728); memmove(prach2+36834,prach2,73728);
prach_len = 2*18432+Ncp; prach_len = 2*18432+Ncp;
} }
} }
......
...@@ -100,7 +100,9 @@ multicast_link_init(void) ...@@ -100,7 +100,9 @@ multicast_link_init(void)
// struct ifreq ifr; // struct ifreq ifr;
for (group = 0; group < MULTICAST_LINK_NUM_GROUPS; group++) { for (group = 0; group < MULTICAST_LINK_NUM_GROUPS; group++) {
strcpy (group_list[group].host_addr, multicast_group_list[group]); //strcpy (group_list[group].host_addr, multicast_group_list[group]);
strncpy (group_list[group].host_addr, multicast_group_list[group], sizeof(group_list[group].host_addr));
group_list[group].host_addr[sizeof(group_list[group].host_addr) - 1] = 0; // terminate string
group_list[group].port = 46014 + group; group_list[group].port = 46014 + group;
group_list[group].socket = make_socket_inet( group_list[group].socket = make_socket_inet(
SOCK_DGRAM, SOCK_DGRAM,
...@@ -159,8 +161,7 @@ multicast_link_init(void) ...@@ -159,8 +161,7 @@ multicast_link_init(void)
memset (&group_list[group].sock_remote_addr, 0, sizeof (struct sockaddr_in)); memset (&group_list[group].sock_remote_addr, 0, sizeof (struct sockaddr_in));
group_list[group].sock_remote_addr.sin_family = AF_INET; group_list[group].sock_remote_addr.sin_family = AF_INET;
group_list[group].sock_remote_addr.sin_addr.s_addr = inet_addr ( group_list[group].sock_remote_addr.sin_addr.s_addr = inet_addr (multicast_group_list[group]);
multicast_group_list[group]);
group_list[group].sock_remote_addr.sin_port = htons (group_list[group].port); group_list[group].sock_remote_addr.sin_port = htons (group_list[group].port);
} }
} }
......
...@@ -189,6 +189,8 @@ double compute_sinr(channel_desc_t *desc, ...@@ -189,6 +189,8 @@ double compute_sinr(channel_desc_t *desc,
struct complex S_i1; struct complex S_i1;
struct complex S_i2; struct complex S_i2;
DevAssert( nb_rb > 0 );
avg_sinr=0.0; avg_sinr=0.0;
// printf("nb_rb %d\n",nb_rb); // printf("nb_rb %d\n",nb_rb);
for (f=0;f<2*nb_rb;f++) { for (f=0;f<2*nb_rb;f++) {
......
...@@ -471,7 +471,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -471,7 +471,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex*));
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
......
...@@ -877,7 +877,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -877,7 +877,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
lib_config_file_name_pP, i, nb_antennas_rx); lib_config_file_name_pP, i, nb_antennas_rx);
enb_properties.properties[enb_properties_index]->tx_gain[j] = tx_gain; enb_properties.properties[enb_properties_index]->tx_gain[j] = tx_gain;
if ((tx_gain <0) || (nb_antennas_tx > 127)) if ((tx_gain <0) || (tx_gain > 127))
AssertError (0, parse_errors ++, AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for tx_gain choice: 0..127 !\n", "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for tx_gain choice: 0..127 !\n",
lib_config_file_name_pP, i, tx_gain); lib_config_file_name_pP, i, tx_gain);
...@@ -1075,7 +1075,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -1075,7 +1075,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
&& config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_SRS_MAXUPPTS, &srs_MaxUpPts) && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_SRS_MAXUPPTS, &srs_MaxUpPts)
)) ))
AssertError(0, parse_errors++,"Failed to parse eNB configuration file %s, enb %d unknown values for srs_BandwidthConfig, srs_SubframeConfig, srs_ackNackST, srs_MaxUpPts\n", AssertError(0, parse_errors++,"Failed to parse eNB configuration file %s, enb %d unknown values for srs_BandwidthConfig, srs_SubframeConfig, srs_ackNackST, srs_MaxUpPts\n",
lib_config_file_name_pP, i, srs_BandwidthConfig); // lib_config_file_name_pP, i, srs_BandwidthConfig);
lib_config_file_name_pP, i);
enb_properties.properties[enb_properties_index]->srs_BandwidthConfig[j] = srs_BandwidthConfig; enb_properties.properties[enb_properties_index]->srs_BandwidthConfig[j] = srs_BandwidthConfig;
if ((srs_BandwidthConfig < 0) || (srs_BandwidthConfig >7)) if ((srs_BandwidthConfig < 0) || (srs_BandwidthConfig >7))
...@@ -1223,7 +1224,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -1223,7 +1224,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
&& config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB, &rach_messagePowerOffsetGroupB))) && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB, &rach_messagePowerOffsetGroupB)))
AssertError (0, parse_errors ++, AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, enb %d rach_sizeOfRA_PreamblesGroupA, messageSizeGroupA,messagePowerOffsetGroupB!\n", "Failed to parse eNB configuration file %s, enb %d rach_sizeOfRA_PreamblesGroupA, messageSizeGroupA,messagePowerOffsetGroupB!\n",
lib_config_file_name_pP, i, pucch_deltaF_Format2b); // lib_config_file_name_pP, i, pucch_deltaF_Format2b);
lib_config_file_name_pP, i);
enb_properties.properties[enb_properties_index]->rach_sizeOfRA_PreamblesGroupA[j] = (rach_sizeOfRA_PreamblesGroupA/4)-1; enb_properties.properties[enb_properties_index]->rach_sizeOfRA_PreamblesGroupA[j] = (rach_sizeOfRA_PreamblesGroupA/4)-1;
if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>60) || ((rach_numberOfRA_Preambles&3)!=0)) if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>60) || ((rach_numberOfRA_Preambles&3)!=0))
......
...@@ -236,7 +236,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i ...@@ -236,7 +236,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i
T=MGRP/10; T=MGRP/10;
//check the measurement gap and sr prohibit timer //check the measurement gap and sr prohibit timer
if ((subframe == gapOffset %10) && ((frameP %T) == (floor(gapOffset/10))) if ((subframe == gapOffset %10) && ((frameP %T) == (floor(gapOffset/10)))
&& (UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running =0)){ && (UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running ==0)){
UE_mac_inst[module_idP].scheduling_info.SR_pending=1; UE_mac_inst[module_idP].scheduling_info.SR_pending=1;
return(0); return(0);
} }
......
...@@ -95,7 +95,7 @@ void rlc_am_pdu_polling ( ...@@ -95,7 +95,7 @@ void rlc_am_pdu_polling (
rlc_pP->rb_id, rlc_pP->rb_id,
rlc_pP->poll_pdu); rlc_pP->poll_pdu);
} }
if (rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) { if (rlc_pP->c_byte_without_poll >= rlc_pP->poll_byte) {
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX NUM BYTES THRESHOLD %d HAS BEEN REACHED\n", LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX NUM BYTES THRESHOLD %d HAS BEEN REACHED\n",
ctxt_pP->frame, ctxt_pP->frame,
(ctxt_pP->enb_flag) ? "eNB" : "UE", (ctxt_pP->enb_flag) ? "eNB" : "UE",
......
...@@ -967,7 +967,7 @@ uint8_t do_SIB23(uint8_t Mod_id, ...@@ -967,7 +967,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70; (*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70;
(*sib3)->intraFreqCellReselectionInfo.p_Max = NULL; (*sib3)->intraFreqCellReselectionInfo.p_Max = NULL;
(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof((*sib3)->intraFreqCellReselectionInfo.s_IntraSearch)); (*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch));
*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31; *(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31;
(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth)); (*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth));
...@@ -1365,7 +1365,8 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id, ...@@ -1365,7 +1365,8 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id,
// RRCConnectionSetup // RRCConnectionSetup
// Configure SRB1 // Configure SRB1
*SRB_configList = CALLOC(1,sizeof(*SRB_configList)); // *SRB_configList = CALLOC(1,sizeof(*SRB_configList));
*SRB_configList = CALLOC(1,sizeof(SRB_ToAddModList_t));
/// SRB1 /// SRB1
SRB1_config = CALLOC(1,sizeof(*SRB1_config)); SRB1_config = CALLOC(1,sizeof(*SRB1_config));
...@@ -2151,7 +2152,8 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ ...@@ -2151,7 +2152,8 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
memset(&measresult_cgi2->cellGlobalId.plmn_Identity,0,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity)); memset(&measresult_cgi2->cellGlobalId.plmn_Identity,0,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity));
measresult_cgi2->cellGlobalId.plmn_Identity.mcc=CALLOC(1,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); // measresult_cgi2->cellGlobalId.plmn_Identity.mcc=CALLOC(1,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity.mcc));
measresult_cgi2->cellGlobalId.plmn_Identity.mcc = CALLOC(1, sizeof(*measresult_cgi2->cellGlobalId.plmn_Identity.mcc));
asn_set_empty(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list);//.size=0; asn_set_empty(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list);//.size=0;
...@@ -2312,7 +2314,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) { ...@@ -2312,7 +2314,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
UE_EUTRA_Capability_t *UE_EUTRA_Capability; UE_EUTRA_Capability_t *UE_EUTRA_Capability;
char UE_EUTRA_Capability_xer[8192]; char UE_EUTRA_Capability_xer[8192];
size_t size; size_t size;
FILE *f;
LOG_I(RRC,"Allocating %u bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability)); LOG_I(RRC,"Allocating %u bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability));
...@@ -2406,11 +2407,13 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) { ...@@ -2406,11 +2407,13 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
else { else {
f = fopen(UE_EUTRA_Capability_xer_fname, "r"); FILE* f = fopen(UE_EUTRA_Capability_xer_fname, "r");
assert(f); assert(f);
size = fread(UE_EUTRA_Capability_xer, 1, sizeof UE_EUTRA_Capability_xer, f); size = fread(UE_EUTRA_Capability_xer, 1, sizeof UE_EUTRA_Capability_xer, f);
fclose(f);
if (size == 0 || size == sizeof UE_EUTRA_Capability_xer) { if (size == 0 || size == sizeof UE_EUTRA_Capability_xer) {
LOG_E(RRC,"UE Capabilities XER file %s is too large\n", UE_EUTRA_Capability_xer_fname); LOG_E(RRC,"UE Capabilities XER file %s is too large\n", UE_EUTRA_Capability_xer_fname);
free( UE_EUTRA_Capability);
return(NULL); return(NULL);
} }
...@@ -2469,6 +2472,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) { ...@@ -2469,6 +2472,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
sprintf (&sdu[3 * i], "%02x.", UECapability.sdu[i]); sprintf (&sdu[3 * i], "%02x.", UECapability.sdu[i]);
LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu); LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu);
free(sdu);
} }
return(&UECapability); return(&UECapability);
......
...@@ -815,7 +815,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration( ...@@ -815,7 +815,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config);
// Configure DRB // Configure DRB
*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); //*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
*DRB_configList = CALLOC(1, sizeof(**DRB_configList));
/// DRB /// DRB
DRB_config = CALLOC(1, sizeof(*DRB_config)); DRB_config = CALLOC(1, sizeof(*DRB_config));
...@@ -1395,10 +1396,16 @@ void rrc_eNB_generate_HandoverPreparationInformation( ...@@ -1395,10 +1396,16 @@ void rrc_eNB_generate_HandoverPreparationInformation(
handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value
handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify!
memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock,
(void *)&eNB_rrc_inst[enb_mod_idP].mib, sizeof(MasterInformationBlock_t)); (void *)&eNB_rrc_inst[enb_mod_idP].mib, sizeof(MasterInformationBlock_t));
memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, memcpy((void *)&handoverInfo->as_config.sourceMeasConfig,
(void *)&eNB_rrc_inst[enb_mod_idP].measConfig[ue_mod_idP], sizeof(MeasConfig_t)); (void *)&eNB_rrc_inst[enb_mod_idP].measConfig[ue_mod_idP], sizeof(MeasConfig_t));
// FIXME handoverInfo not used...
free( handoverInfo );
handoverInfo = 0;
//to be configured //to be configured
memset((void *)&eNB_rrc_inst[enb_mod_idP].handover_info[ue_mod_idP]->as_config.sourceSecurityAlgorithmConfig, memset((void *)&eNB_rrc_inst[enb_mod_idP].handover_info[ue_mod_idP]->as_config.sourceSecurityAlgorithmConfig,
0, sizeof(SecurityAlgorithmConfig_t)); 0, sizeof(SecurityAlgorithmConfig_t));
......
...@@ -77,7 +77,7 @@ char* getNetMask (){ ...@@ -77,7 +77,7 @@ char* getNetMask (){
} }
void setBroadcastAddress (char* baseAddr){ void setBroadcastAddress (char* baseAddr){
strcpy(baseAddr, baseAddr); strcpy(broadcastAddr, baseAddr);
} }
char* getBroadcastAddress (){ char* getBroadcastAddress (){
...@@ -219,6 +219,7 @@ int bringInterfaceUp(char *interfaceName, int up) ...@@ -219,6 +219,7 @@ int bringInterfaceUp(char *interfaceName, int up)
} }
// printf("UP/DOWN OK!\n"); // printf("UP/DOWN OK!\n");
close( sock_fd );
return 0; return 0;
} }
// non blocking full configuration of the interface (address, net mask, and broadcast mask) // non blocking full configuration of the interface (address, net mask, and broadcast mask)
...@@ -283,13 +284,13 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask, ...@@ -283,13 +284,13 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask,
command[0]='\0'; command[0]='\0';
strcat(command, "ifconfig "); strcat(command, "ifconfig ");
strcat(command, interfaceName); strncat(command, interfaceName, sizeof(command) - strlen(command) - 1);
strcat(command, " "); strncat(command, " ", sizeof(command) - strlen(command) - 1);
strcat(command, ipAddress); strncat(command, ipAddress, sizeof(command) - strlen(command) - 1);
strcat(command, " networkMask "); strncat(command, " networkMask ", sizeof(command) - strlen(command) - 1);
strcat(command, networkMask); strncat(command, networkMask, sizeof(command) - strlen(command) - 1);
strcat(command, " broadcast "); strncat(command, " broadcast ", sizeof(command) - strlen(command) - 1);
strcat(command, broadcastAddress); strncat(command, broadcastAddress, sizeof(command) - strlen(command) - 1);
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255 // ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
int i = system (command); int i = system (command);
......
...@@ -217,9 +217,13 @@ int OCG_main(char is_local_server[FILENAME_LENGTH_MAX]) { ...@@ -217,9 +217,13 @@ int OCG_main(char is_local_server[FILENAME_LENGTH_MAX]) {
case STATE_GENERATE_REPORT : case STATE_GENERATE_REPORT :
if (create_dir_OK != MODULE_OK) { if (create_dir_OK != MODULE_OK) {
// a temp folder is required when the output folder could not be correctly generated // a temp folder is required when the output folder could not be correctly generated
strcpy(output_dir, OPENAIR_TARGETS); //strcpy(output_dir, OPENAIR_TARGETS);
strcat(output_dir, "SIMU/EXAMPLES/OSD/"); //strcat(output_dir, "SIMU/EXAMPLES/OSD/");
strcat(output_dir, TEMP_OUTPUT_DIR); //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; struct stat st;
if(stat(output_dir, &st) != 0) { // if temp output directory does not exist, we create it here 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); mkdir(output_dir, S_IRWXU | S_IRWXG | S_IRWXO);
......
...@@ -52,7 +52,9 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M ...@@ -52,7 +52,9 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M
char directory[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = ""; char directory[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
mode_t process_mask = umask(0); 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; struct stat st;
if(stat(directory, &st) != 0) { // if output_dir does not exist, we create it here if(stat(directory, &st) != 0) { // if output_dir does not exist, we create it here
...@@ -60,12 +62,15 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M ...@@ -60,12 +62,15 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M
LOG_I(OCG, "output_dir %s is created", directory); 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); mkdir(directory, S_IRWXU | S_IRWXG | S_IRWXO);
strcat(directory, "/"); // strcat(directory, "/");
strcat(directory, file_date); //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); mkdir(directory, S_IRWXU | S_IRWXG |S_IRWXO);
......
...@@ -92,8 +92,11 @@ int detect_file(char src_dir[DIR_LENGTH_MAX], char is_local_server[FILENAME_LENG ...@@ -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]; char check_src_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX];
strcpy(check_src_file, src_dir); //strcpy(check_src_file, src_dir);
strcat(check_src_file, filename); //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; struct stat st;
if(stat(check_src_file, &st) != 0) { if(stat(check_src_file, &st) != 0) {
LOG_E(OCG, "file %s does not exist\n", check_src_file); LOG_E(OCG, "file %s does not exist\n", check_src_file);
......
...@@ -54,8 +54,10 @@ int generate_report(char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_ ...@@ -54,8 +54,10 @@ 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 // for the xml writer, refer to http://xmlsoft.org/html/libxml-xmlwriter.html
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = ""; char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
strcat(dst_file, dst_dir); //strcat(dst_file, dst_dir);
strcat(dst_file, filename); //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; xmlTextWriterPtr writer;
......
...@@ -1249,9 +1249,11 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o ...@@ -1249,9 +1249,11 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) { // called o
oai_emulation.info.opp_enabled = atoi(ch); oai_emulation.info.opp_enabled = atoi(ch);
} else if (trace_file_) { } else if (trace_file_) {
oai_emulation.info.opt_enabled = 1; oai_emulation.info.opt_enabled = 1;
if (strcmp(strndup(ch, len), "wireshark") == 0) { // if (strcmp(strndup(ch, len), "wireshark") == 0) {
if (strncmp(ch, "wireshark", len) == 0) {
opt_type = OPT_WIRESHARK; opt_type = OPT_WIRESHARK;
} else if (strcmp(strndup(ch, len), "pcap") == 0) { // } else if (strcmp(strndup(ch, len), "pcap") == 0) {
} else if (strncmp(ch, "pcap", len) == 0) {
opt_type = OPT_PCAP; opt_type = OPT_PCAP;
} else { } else {
opt_type = OPT_NONE; opt_type = OPT_NONE;
......
...@@ -56,7 +56,9 @@ int parse_filename(char filename[FILENAME_LENGTH_MAX]) { ...@@ -56,7 +56,9 @@ int parse_filename(char filename[FILENAME_LENGTH_MAX]) {
char *ex_tmp; char *ex_tmp;
//delim = "._"; //delim = "._";
strcpy(tmp_filename, filename); // 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); un_tmp = strtok(tmp_filename, delim);
fd_tmp = strtok(NULL, delim); fd_tmp = strtok(NULL, delim);
...@@ -66,8 +68,13 @@ int parse_filename(char filename[FILENAME_LENGTH_MAX]) { ...@@ -66,8 +68,13 @@ int parse_filename(char filename[FILENAME_LENGTH_MAX]) {
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"); 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; return MODULE_ERROR;
} else { } else {
strcpy(file_date, fd_tmp); //strcpy(file_date, fd_tmp);
strcpy(user_name, un_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); LOG_I(OCG, "File name is parsed as user_name = %s, file_date = %s\n", user_name, file_date);
return MODULE_OK; return MODULE_OK;
} }
......
...@@ -50,14 +50,19 @@ ...@@ -50,14 +50,19 @@
int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename) { int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename) {
FILE *fs, *ft; FILE *fs, *ft;
char ch; int ch;
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = ""; char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
char XML_saving_dir[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = ""; char XML_saving_dir[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
strcpy(dst_file, output_dir); //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/"); //strcat(dst_file, "SCENARIO/XML/");
strcpy(XML_saving_dir, dst_file); //strcpy(XML_saving_dir, dst_file);
strcat(dst_file, filename); //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"); fs = fopen(src_file, "r");
ft = fopen(dst_file, "w"); ft = fopen(dst_file, "w");
if ((ft !=NULL)&&(fs!=NULL)){ if ((ft !=NULL)&&(fs!=NULL)){
...@@ -70,9 +75,12 @@ int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename) ...@@ -70,9 +75,12 @@ int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename)
} }
} }
}
if (fs)
fclose(fs); fclose(fs);
if (ft)
fclose(ft); fclose(ft);
}
if (copy_or_move == 2) remove(src_file); if (copy_or_move == 2) remove(src_file);
LOG_I(OCG, "The file is saved in directory \"%s\"\n", XML_saving_dir); LOG_I(OCG, "The file is saved in directory \"%s\"\n", XML_saving_dir);
......
...@@ -164,6 +164,7 @@ void processSubscriptions() { ...@@ -164,6 +164,7 @@ void processSubscriptions() {
continue; continue;
} }
} }
free( objID );
} }
} }
...@@ -211,7 +212,8 @@ int extractCommandStatus(storage *s, unsigned char commandId, char * description ...@@ -211,7 +212,8 @@ int extractCommandStatus(storage *s, unsigned char commandId, char * description
description = readString(); description = readString();
// print description if needed // print description if needed
free( description );
description = 0;
//free actual message content //free actual message content
//depends on the message which is handled //depends on the message which is handled
...@@ -325,6 +327,8 @@ void commandGetVehicleVariable(char *vehID, int varID)// malloc for vehID and va ...@@ -325,6 +327,8 @@ void commandGetVehicleVariable(char *vehID, int varID)// malloc for vehID and va
UNUSED_VARIABLE(rs); UNUSED_VARIABLE(rs);
UNUSED_VARIABLE(valueDataType); UNUSED_VARIABLE(valueDataType);
UNUSED_VARIABLE(domID); UNUSED_VARIABLE(domID);
free( rs );
} }
} }
......
...@@ -118,6 +118,7 @@ void sendExact(int cmdLength){ ...@@ -118,6 +118,7 @@ void sendExact(int cmdLength){
buf +=n; buf +=n;
} }
freeStorage(storageStart); freeStorage(storageStart);
free(buf);
} }
...@@ -147,6 +148,9 @@ storage * receiveExact(){ ...@@ -147,6 +148,9 @@ storage * receiveExact(){
// create storage to access the content // create storage to access the content
tracker = writePacket(bufLength, 4); tracker = writePacket(bufLength, 4);
free( bufLength );
bufLength = 0;
// store pointer to free the space later // store pointer to free the space later
// storage *freeTracker = tracker; // storage *freeTracker = tracker;
int s= readInt(); int s= readInt();
...@@ -184,7 +188,10 @@ storage * receiveExact(){ ...@@ -184,7 +188,10 @@ storage * receiveExact(){
bytesRead += readThisTime; bytesRead += readThisTime;
} }
return writePacket(buf, NN); storage* temp = writePacket(buf, NN);
free( buf );
return temp;
//return writePacket(buf, NN);
} }
......
...@@ -211,7 +211,8 @@ update_IDs (void) ...@@ -211,7 +211,8 @@ update_IDs (void)
if (tmp_departed->string != NULL) 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); strcpy (tmp_string, tmp_departed->string);
//printf("OMG - 2 head is not null and value is: %s\n",tmp_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); int OAI_ID = get_oaiID_by_SUMO (tmp_string, id_manager);
...@@ -221,16 +222,19 @@ update_IDs (void) ...@@ -221,16 +222,19 @@ update_IDs (void)
{ {
// printf("Reached the Maximum of OAI nodes to be mapped to SUMO\n"); // 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"); // 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; return; // stopping mapping as the maximum of OAI nodes has been reached;
} }
} }
free( tmp_string );
} }
while (tmp_departed->next != NULL) while (tmp_departed->next != NULL)
{ {
// printf("OMG - 2 main is not null \n"); // printf("OMG - 2 main is not null \n");
//char tmp_string [strlen(tmp_departed->string)]; //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); strcpy (tmp_string, tmp_departed->string);
//char *tmp_string = tmp_departed->string; //char *tmp_string = tmp_departed->string;
int OAI_ID = get_oaiID_by_SUMO (tmp_string, id_manager); int OAI_ID = get_oaiID_by_SUMO (tmp_string, id_manager);
...@@ -240,9 +244,11 @@ update_IDs (void) ...@@ -240,9 +244,11 @@ update_IDs (void)
{ {
//printf("Reached the Maximum of OAI nodes to be mapped to SUMO\n"); //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"); //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; return; // stopping mapping as the maximum of OAI nodes has been reached;
} }
} }
free( tmp_string );
tmp_departed = tmp_departed->next; tmp_departed = tmp_departed->next;
} }
...@@ -324,8 +330,7 @@ activate_and_map (char *sumo_id) ...@@ -324,8 +330,7 @@ activate_and_map (char *sumo_id)
LOG_I (OMG, "activating node %s \n", sumo_id); LOG_I (OMG, "activating node %s \n", sumo_id);
#endif #endif
// TODO: So far, only UE can be SUMO mobile, but could change // TODO: So far, only UE can be SUMO mobile, but could change
node_struct *active_node = node_struct *active_node = get_first_inactive_OAI_node (node_vector[SUMO], UE);
get_first_inactive_OAI_node (node_vector[SUMO], UE);
if (active_node != NULL) if (active_node != NULL)
{ // found an inactive OAI node; will be mapped to SUMO { // found an inactive OAI node; will be mapped to SUMO
active_node->mobile = 1; // now node is active in SUMO active_node->mobile = 1; // now node is active in SUMO
...@@ -333,7 +338,8 @@ activate_and_map (char *sumo_id) ...@@ -333,7 +338,8 @@ activate_and_map (char *sumo_id)
active_nodes = add_entry (active_node, active_nodes); active_nodes = add_entry (active_node, active_nodes);
map->oai_id = active_node->id; 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); strcpy (map->sumo_id, sumo_id);
#ifdef STANDALONE #ifdef STANDALONE
...@@ -345,6 +351,7 @@ activate_and_map (char *sumo_id) ...@@ -345,6 +351,7 @@ activate_and_map (char *sumo_id)
#endif #endif
// TODO fusion the two lists...leads to data inconsistency // 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 = id_manager->map_sumo2oai =
add_map_entry (map, id_manager->map_sumo2oai); add_map_entry (map, id_manager->map_sumo2oai);
......
...@@ -394,7 +394,9 @@ fc=fopen("/tmp/otg.log","w");; ...@@ -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); LOG_E(OTG,"(src=%d, dst=%d, appli %d) : Unknown traffic \n ", i, j,k);
strcpy(traffic,"UKNOWN TRAFFIC"); strcpy(traffic,"UKNOWN TRAFFIC");
} else { } 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)){ ...@@ -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] 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 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] Estimated E2E OWD MAX (one way)ms= %.2f \n", max_owd_dl_e2e);
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] 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] 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] 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] 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); 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)){ ...@@ -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] 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 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] ESTIMATED E2E OWD MAX (one way)ms= %.2f \n", max_owd_dl_e2e);
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] 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] 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] 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] 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 ); 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)){ ...@@ -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] 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 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] ESTIMATED E2E OWD MAX (one way)ms= %.2f \n", max_owd_ul_e2e);
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] 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] 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] 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] 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 ); 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)){ ...@@ -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] 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 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] ESTIMATED E2E OWD MAX (one way)ms= %.2f \n", max_owd_ul_e2e);
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] 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] 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] 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] 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 ); LOG_F(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_ul - rx_total_pkts_ul );
......
...@@ -1406,7 +1406,7 @@ break; ...@@ -1406,7 +1406,7 @@ break;
g_otg->trans_proto[i][j][k] = TCP; g_otg->trans_proto[i][j][k] = TCP;
g_otg->ip_v[i][j][k] = IPV4; g_otg->ip_v[i][j][k] = IPV4;
g_otg->idt_dist[i][j][k][PE_STATE] = UNIFORM; 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_min[i][j][k][PE_STATE] = 40;
g_otg->idt_max[i][j][k][PE_STATE] = 80; g_otg->idt_max[i][j][k][PE_STATE] = 80;
g_otg->size_dist[i][j][k][PE_STATE] = BACKGROUND_DIST; g_otg->size_dist[i][j][k][PE_STATE] = BACKGROUND_DIST;
......
...@@ -97,7 +97,9 @@ void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void* ...@@ -97,7 +97,9 @@ void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void*
intps=time(NULL); intps=time(NULL);
pdh = localtime(&intps); pdh = localtime(&intps);
char *date_cpy = malloc (sizeof (char) * 256); char *date_cpy = malloc (sizeof (char) * 256);
strcpy(date_cpy,date); //strcpy(date_cpy,date);
strncpy( date_cpy, date, 256 );
date_cpy[255] = 0; // terminate string
// second count the frame to reach the time // second count the frame to reach the time
char *heure = NULL; char *heure = NULL;
int heure_int; int heure_int;
...@@ -111,11 +113,14 @@ void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void* ...@@ -111,11 +113,14 @@ void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void*
char *minute = NULL; char *minute = NULL;
heure = strtok(date_cpy,"h"); heure = strtok(date_cpy,"h");
//heure = strchr(date,'h'); //heure = strchr(date,'h');
printf("heure char : %s", heure); printf("hour char : %s", heure);
minute = strchr(date,'h'); minute = strchr(date,'h');
printf("minute char : %s", minute+1); printf("minute char : %s", minute+1);
free( date_cpy );
date_cpy = 0;
heure_int = atoi(heure); heure_int = atoi(heure);
minute_int = atoi(minute+1); minute_int = atoi(minute+1);
...@@ -451,7 +456,7 @@ void update_mac(Event_t event) { ...@@ -451,7 +456,7 @@ void update_mac(Event_t event) {
if((Mac_config *) event.value !=NULL && validate_mac(event)) if((Mac_config *) event.value !=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"update complete mac params \n"); LOG_I(EMU,"update complete mac params \n");
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -571,7 +576,7 @@ void update_mac(Event_t event) { ...@@ -571,7 +576,7 @@ void update_mac(Event_t event) {
} }
else else
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"update complete mac params \n"); LOG_I(EMU,"update complete mac params \n");
i = event.ue; i = event.ue;
...@@ -694,7 +699,7 @@ void update_mac(Event_t event) { ...@@ -694,7 +699,7 @@ void update_mac(Event_t event) {
} }
else if(!strcmp((char *) event.key, "priority") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "priority") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
LOG_I(EMU,"priority update \n"); LOG_I(EMU,"priority update \n");
...@@ -725,7 +730,7 @@ void update_mac(Event_t event) { ...@@ -725,7 +730,7 @@ void update_mac(Event_t event) {
} }
else if(!strcmp((char *) event.key, "DCI_aggregation_min") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "DCI_aggregation_min") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"DCI_aggregation_min update \n"); LOG_I(EMU,"DCI_aggregation_min update \n");
...@@ -750,7 +755,7 @@ void update_mac(Event_t event) { ...@@ -750,7 +755,7 @@ void update_mac(Event_t event) {
} }
else if(!strcmp((char *) event.key, "DLSCH_dci_size_bits") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "DLSCH_dci_size_bits") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
...@@ -779,7 +784,7 @@ void update_mac(Event_t event) { ...@@ -779,7 +784,7 @@ void update_mac(Event_t event) {
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -815,7 +820,7 @@ void update_mac(Event_t event) { ...@@ -815,7 +820,7 @@ void update_mac(Event_t event) {
else if(!strcmp((char *) event.key, "dl_bandwidth") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "dl_bandwidth") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -852,7 +857,7 @@ void update_mac(Event_t event) { ...@@ -852,7 +857,7 @@ void update_mac(Event_t event) {
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -888,7 +893,7 @@ void update_mac(Event_t event) { ...@@ -888,7 +893,7 @@ void update_mac(Event_t event) {
else if(!strcmp((char *) event.key, "min_dl_bandwidth") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "min_dl_bandwidth") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -906,7 +911,7 @@ void update_mac(Event_t event) { ...@@ -906,7 +911,7 @@ void update_mac(Event_t event) {
{ {
oai_emulation->mac_config[i].min_dl_bandwidth[j]= mac_config[i].min_dl_bandwidth[j]; oai_emulation->mac_config[i].min_dl_bandwidth[j]= mac_config[i].min_dl_bandwidth[j];
UE_list->UE_sched_ctrl[i].min_dl_bandwidth[j] = oai_emulation->mac_config[i].min_dl_bandwidth[j]; UE_list->UE_sched_ctrl[i].min_dl_bandwidth[j] = oai_emulation->mac_config[i].min_dl_bandwidth[j];
LOG_I(EMU,"dl_bandwidth UE %d LCID %d:",i,j); LOG_I(EMU,"min_dl_bandwidth UE %d LCID %d:",i,j);
LOG_I(EMU,"%" PRIu8 "\n",UE_list->UE_sched_ctrl[i].min_dl_bandwidth[j]); LOG_I(EMU,"%" PRIu8 "\n",UE_list->UE_sched_ctrl[i].min_dl_bandwidth[j]);
} }
} }
...@@ -923,7 +928,7 @@ void update_mac(Event_t event) { ...@@ -923,7 +928,7 @@ void update_mac(Event_t event) {
} }
else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateDL") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateDL") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"ue_AggregatedMaximumBitrateDL update \n"); LOG_I(EMU,"ue_AggregatedMaximumBitrateDL update \n");
...@@ -950,7 +955,7 @@ void update_mac(Event_t event) { ...@@ -950,7 +955,7 @@ void update_mac(Event_t event) {
else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateUL") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateUL") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"ue_AggregatedMaximumBitrateUL update \n"); LOG_I(EMU,"ue_AggregatedMaximumBitrateUL update \n");
...@@ -976,7 +981,7 @@ void update_mac(Event_t event) { ...@@ -976,7 +981,7 @@ void update_mac(Event_t event) {
} }
else if(!strcmp((char *) event.key, "cqiSchedInterval") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "cqiSchedInterval") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"cqiSchedInterval update \n"); LOG_I(EMU,"cqiSchedInterval update \n");
...@@ -1001,7 +1006,7 @@ void update_mac(Event_t event) { ...@@ -1001,7 +1006,7 @@ void update_mac(Event_t event) {
} }
else if(!strcmp((char *) event.key, "mac_ContentionResolutionTimer") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "mac_ContentionResolutionTimer") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"mac_ContentionResolutionTimer update \n"); LOG_I(EMU,"mac_ContentionResolutionTimer update \n");
if(event.ue == -1) if(event.ue == -1)
...@@ -1027,7 +1032,7 @@ void update_mac(Event_t event) { ...@@ -1027,7 +1032,7 @@ void update_mac(Event_t event) {
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -1064,9 +1069,7 @@ void update_mac(Event_t event) { ...@@ -1064,9 +1069,7 @@ void update_mac(Event_t event) {
else if(!strcmp((char *) event.key, "max_mcs") && event.value!=NULL && validate_mac(event)) else if(!strcmp((char *) event.key, "max_mcs") && event.value!=NULL && validate_mac(event))
{ {
Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
Mac_config* mac_config = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -2611,7 +2614,7 @@ int validate_mac(Event_t event) ...@@ -2611,7 +2614,7 @@ int validate_mac(Event_t event)
int i=0; int i=0;
if(event.key ==NULL && event.value!=NULL) if(event.key ==NULL && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -2724,7 +2727,7 @@ int validate_mac(Event_t event) ...@@ -2724,7 +2727,7 @@ int validate_mac(Event_t event)
{ {
//check one param //check one param
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
i = event.ue; i = event.ue;
...@@ -2824,7 +2827,7 @@ int validate_mac(Event_t event) ...@@ -2824,7 +2827,7 @@ int validate_mac(Event_t event)
//printf("check one param"); //printf("check one param");
if(!strcmp((char *) event.key, "priority") && event.value!=NULL) if(!strcmp((char *) event.key, "priority") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid ==-1) if(event.ue == -1 && event.lcid ==-1)
...@@ -2857,7 +2860,7 @@ int validate_mac(Event_t event) ...@@ -2857,7 +2860,7 @@ int validate_mac(Event_t event)
} }
else if(!strcmp((char *) event.key, "DCI_aggregation_min") && event.value!=NULL) else if(!strcmp((char *) event.key, "DCI_aggregation_min") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
if(event.ue == -1) if(event.ue == -1)
...@@ -2883,7 +2886,7 @@ int validate_mac(Event_t event) ...@@ -2883,7 +2886,7 @@ int validate_mac(Event_t event)
} }
else if(!strcmp((char *) event.key, "DLSCH_dci_size_bits") && event.value!=NULL) else if(!strcmp((char *) event.key, "DLSCH_dci_size_bits") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
...@@ -2911,7 +2914,7 @@ int validate_mac(Event_t event) ...@@ -2911,7 +2914,7 @@ int validate_mac(Event_t event)
else if(!strcmp((char *) event.key, "ul_bandwidth") && event.value!=NULL) else if(!strcmp((char *) event.key, "ul_bandwidth") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -2945,7 +2948,7 @@ int validate_mac(Event_t event) ...@@ -2945,7 +2948,7 @@ int validate_mac(Event_t event)
else if(!strcmp((char *) event.key, "min_ul_bandwidth") && event.value!=NULL) else if(!strcmp((char *) event.key, "min_ul_bandwidth") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -2980,7 +2983,7 @@ int validate_mac(Event_t event) ...@@ -2980,7 +2983,7 @@ int validate_mac(Event_t event)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -3015,7 +3018,7 @@ int validate_mac(Event_t event) ...@@ -3015,7 +3018,7 @@ int validate_mac(Event_t event)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -3048,7 +3051,7 @@ int validate_mac(Event_t event) ...@@ -3048,7 +3051,7 @@ int validate_mac(Event_t event)
} }
else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateDL") && event.value!=NULL) else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateDL") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
LOG_I(EMU,"ue_AggregatedMaximumBitrateDL update \n"); LOG_I(EMU,"ue_AggregatedMaximumBitrateDL update \n");
...@@ -3072,7 +3075,7 @@ int validate_mac(Event_t event) ...@@ -3072,7 +3075,7 @@ int validate_mac(Event_t event)
else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateUL") && event.value!=NULL) else if(!strcmp((char *) event.key, "ue_AggregatedMaximumBitrateUL") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
...@@ -3095,7 +3098,7 @@ int validate_mac(Event_t event) ...@@ -3095,7 +3098,7 @@ int validate_mac(Event_t event)
} }
else if(!strcmp((char *) event.key, "cqiSchedInterval") && event.value!=NULL) else if(!strcmp((char *) event.key, "cqiSchedInterval") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
if(event.ue == -1) if(event.ue == -1)
...@@ -3115,7 +3118,7 @@ int validate_mac(Event_t event) ...@@ -3115,7 +3118,7 @@ int validate_mac(Event_t event)
} }
else if(!strcmp((char *) event.key, "mac_ContentionResolutionTimer") && event.value!=NULL) else if(!strcmp((char *) event.key, "mac_ContentionResolutionTimer") && event.value!=NULL)
{ {
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
if(event.ue == -1) if(event.ue == -1)
...@@ -3138,7 +3141,7 @@ if(!(mac_config[i].mac_ContentionResolutionTimer==8 || mac_config[i].mac_Content ...@@ -3138,7 +3141,7 @@ if(!(mac_config[i].mac_ContentionResolutionTimer==8 || mac_config[i].mac_Content
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
...@@ -3174,7 +3177,7 @@ if(!(mac_config[i].mac_ContentionResolutionTimer==8 || mac_config[i].mac_Content ...@@ -3174,7 +3177,7 @@ if(!(mac_config[i].mac_ContentionResolutionTimer==8 || mac_config[i].mac_Content
Mac_config* mac_config = malloc(sizeof(Mac_config)*16); Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value; mac_config = (Mac_config *) event.value;
int j=0; int j=0;
if(event.ue == -1 && event.lcid == -1) if(event.ue == -1 && event.lcid == -1)
......
...@@ -736,8 +736,12 @@ int ocg_config_app(void){ ...@@ -736,8 +736,12 @@ int ocg_config_app(void){
LOG_I(OTG,"OCG_config_OTG: predefined no. %d\n", predefined_traffic_config_index); LOG_I(OTG,"OCG_config_OTG: predefined no. %d\n", predefined_traffic_config_index);
strcpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]); //strcpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
strcpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]); //strcpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
strncpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index], sizeof(tmp_source_id));
tmp_source_id[sizeof(tmp_source_id) - 1] = 0; // terminate string
strncpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index], sizeof(tmp_destination_id));
tmp_destination_id[sizeof(tmp_destination_id) - 1] = 0; // terminate string
check_format1 = strstr(tmp_source_id, colon); check_format1 = strstr(tmp_source_id, colon);
check_format2 = strstr(tmp_source_id, comma); check_format2 = strstr(tmp_source_id, comma);
check_format1_dst = strstr(tmp_destination_id, colon); check_format1_dst = strstr(tmp_destination_id, colon);
...@@ -1162,7 +1166,7 @@ int ocg_config_emu(void){ ...@@ -1162,7 +1166,7 @@ int ocg_config_emu(void){
if (oai_emulation.info.opt_enabled == 1) { if (oai_emulation.info.opt_enabled == 1) {
radio_type_t radio_type; radio_type_t radio_type;
if (oai_emulation.info.frame_type == FDD) { if (oai_emulation.info.frame_type[0] == FDD) {
radio_type = RADIO_TYPE_FDD; radio_type = RADIO_TYPE_FDD;
} else { } else {
radio_type = RADIO_TYPE_TDD; radio_type = RADIO_TYPE_TDD;
......
...@@ -388,7 +388,9 @@ void get_simulation_options(int argc, char *argv[]) { ...@@ -388,7 +388,9 @@ void get_simulation_options(int argc, char *argv[]) {
break; break;
case 'c': case 'c':
strcpy(oai_emulation.info.local_server, optarg); //strcpy(oai_emulation.info.local_server, optarg);
strncpy(oai_emulation.info.local_server, optarg, sizeof(oai_emulation.info.local_server));
oai_emulation.info.local_server[sizeof(oai_emulation.info.local_server) - 1] = 0; // terminate string
oai_emulation.info.ocg_enabled=1; oai_emulation.info.ocg_enabled=1;
break; break;
......
...@@ -625,7 +625,7 @@ void get_MIESM_param() { ...@@ -625,7 +625,7 @@ void get_MIESM_param() {
} }
} }
} }
fclose(fp);
for (t = 0; t < 162; t++){ for (t = 0; t < 162; t++){
// MI_map_4Qam[0][t] = pow(10,0.1*(MI_map_4Qam[0][t])); // MI_map_4Qam[0][t] = pow(10,0.1*(MI_map_4Qam[0][t]));
LOG_D(OCM, "MIESM 4QAM Table: %lf %lf %1f\n ",MI_map_4qam[0][t],MI_map_4qam[1][t], MI_map_4qam[2][t]); LOG_D(OCM, "MIESM 4QAM Table: %lf %lf %1f\n ",MI_map_4qam[0][t],MI_map_4qam[1][t], MI_map_4qam[2][t]);
...@@ -645,7 +645,7 @@ void get_MIESM_param() { ...@@ -645,7 +645,7 @@ void get_MIESM_param() {
} }
} }
} }
fclose(fp);
for (t = 0; t < 197; t++){ for (t = 0; t < 197; t++){
// MI_map_16Qam[0][t] = pow(10,0.1*(MI_map_16Qam[0][t])); // MI_map_16Qam[0][t] = pow(10,0.1*(MI_map_16Qam[0][t]));
LOG_D(OCM, "MIESM 16 QAM Table: %lf %lf %1f\n ",MI_map_16qam[0][t],MI_map_16qam[1][t], MI_map_16qam[2][t]); LOG_D(OCM, "MIESM 16 QAM Table: %lf %lf %1f\n ",MI_map_16qam[0][t],MI_map_16qam[1][t], MI_map_16qam[2][t]);
...@@ -667,7 +667,7 @@ void get_MIESM_param() { ...@@ -667,7 +667,7 @@ void get_MIESM_param() {
} }
} }
} }
fclose(fp);
for (t = 0; t < 227; t++){ for (t = 0; t < 227; t++){
//MI_map_64Qam[0][t] = pow(10,0.1*(MI_map_64Qam[0][t])); //MI_map_64Qam[0][t] = pow(10,0.1*(MI_map_64Qam[0][t]));
LOG_D(OCM, "MIESM 64QAM Table: %lf %lf %1f\n ",MI_map_64qam[0][t],MI_map_64qam[1][t], MI_map_64qam[2][t]); LOG_D(OCM, "MIESM 64QAM Table: %lf %lf %1f\n ",MI_map_64qam[0][t],MI_map_64qam[1][t], MI_map_64qam[2][t]);
...@@ -681,6 +681,7 @@ void get_MIESM_param() { ...@@ -681,6 +681,7 @@ void get_MIESM_param() {
} }
} }
fclose(fp);
} }
free(file_path); free(file_path);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment