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,
memcpy((void*)prach,(void*)(prach+36864),Ncp<<2);
prach_len = 18432+Ncp;
if (prach_fmt>1) {
memcpy((void*)(prach2+36834),(void*)prach2,73728);
memmove(prach2+36834,prach2,73728);
prach_len = 2*18432+Ncp;
}
}
......
......@@ -100,68 +100,69 @@ multicast_link_init(void)
// struct ifreq ifr;
for (group = 0; group < MULTICAST_LINK_NUM_GROUPS; group++) {
strcpy (group_list[group].host_addr, multicast_group_list[group]);
group_list[group].port = 46014 + group;
group_list[group].socket = make_socket_inet(
SOCK_DGRAM,
&group_list[group].port, &sin);
LOG_D(EMU, "multicast_link_init(): Created socket %d for group %d, port %d\n",
group_list[group].socket,group,group_list[group].port);
//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].socket = make_socket_inet(
SOCK_DGRAM,
&group_list[group].port, &sin);
LOG_D(EMU, "multicast_link_init(): Created socket %d for group %d, port %d\n",
group_list[group].socket,group,group_list[group].port);
/* Used so we can re-bind to our port while a previous connection is still
* in TIME_WAIT state.
*/
if (setsockopt(group_list[group].socket, SOL_SOCKET, SO_REUSEADDR,
&reuse_addr, sizeof (reuse_addr)) < 0) {
LOG_E(EMU, "[MULTICAST] ERROR : setsockopt:SO_REUSEADDR, exiting ...");
exit (EXIT_FAILURE);
}
if (multicast_if != NULL) {
if (setsockopt(group_list[group].socket, SOL_SOCKET,SO_BINDTODEVICE,
multicast_if, 4) < 0) {
LOG_E(EMU,
"[MULTICAST] ERROR : setsockopt:SO_BINDTODEVICE on interface %s, exiting ...\n",
multicast_if);
LOG_E(EMU,
"[MULTICAST] make sure that you have a root privilage or run with sudo -E \n");
exit (EXIT_FAILURE);
}
}
if (setsockopt(group_list[group].socket, SOL_SOCKET, SO_REUSEADDR,
&reuse_addr, sizeof (reuse_addr)) < 0) {
LOG_E(EMU, "[MULTICAST] ERROR : setsockopt:SO_REUSEADDR, exiting ...");
exit (EXIT_FAILURE);
}
if (multicast_if != NULL) {
if (setsockopt(group_list[group].socket, SOL_SOCKET,SO_BINDTODEVICE,
multicast_if, 4) < 0) {
LOG_E(EMU,
"[MULTICAST] ERROR : setsockopt:SO_BINDTODEVICE on interface %s, exiting ...\n",
multicast_if);
LOG_E(EMU,
"[MULTICAST] make sure that you have a root privilage or run with sudo -E \n");
exit (EXIT_FAILURE);
}
}
#if !defined(ENABLE_NEW_MULTICAST)
/* Make the socket blocking */
socket_setnonblocking(group_list[group].socket);
/* Make the socket blocking */
socket_setnonblocking(group_list[group].socket);
#endif
multicast_loop = 0;
if (setsockopt (group_list[group].socket, IPPROTO_IP, IP_MULTICAST_LOOP,
&multicast_loop, sizeof (multicast_loop)) < 0) {
LOG_E(EMU,
"[MULTICAST] ERROR: %s line %d multicast_link_main_loop() IP_MULTICAST_LOOP %m",
__FILE__, __LINE__);
exit (EXIT_FAILURE);
}
// Join the broadcast group:
command.imr_multiaddr.s_addr = inet_addr (group_list[group].host_addr);
command.imr_interface.s_addr = htonl (INADDR_ANY);
if (command.imr_multiaddr.s_addr == -1) {
LOG_E(EMU, "[MULTICAST] ERROR: %s line %d NO MULTICAST", __FILE__, __LINE__);
exit (EXIT_FAILURE);
}
if (setsockopt (group_list[group].socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
&command, sizeof (command)) < 0) {
LOG_E(EMU, "[MULTICAST] ERROR: %s line %d IP_ADD_MEMBERSHIP %m", __FILE__,
__LINE__);
exit (EXIT_FAILURE);
}
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_addr.s_addr = inet_addr (
multicast_group_list[group]);
group_list[group].sock_remote_addr.sin_port = htons (group_list[group].port);
multicast_loop = 0;
if (setsockopt (group_list[group].socket, IPPROTO_IP, IP_MULTICAST_LOOP,
&multicast_loop, sizeof (multicast_loop)) < 0) {
LOG_E(EMU,
"[MULTICAST] ERROR: %s line %d multicast_link_main_loop() IP_MULTICAST_LOOP %m",
__FILE__, __LINE__);
exit (EXIT_FAILURE);
}
// Join the broadcast group:
command.imr_multiaddr.s_addr = inet_addr (group_list[group].host_addr);
command.imr_interface.s_addr = htonl (INADDR_ANY);
if (command.imr_multiaddr.s_addr == -1) {
LOG_E(EMU, "[MULTICAST] ERROR: %s line %d NO MULTICAST", __FILE__, __LINE__);
exit (EXIT_FAILURE);
}
if (setsockopt (group_list[group].socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
&command, sizeof (command)) < 0) {
LOG_E(EMU, "[MULTICAST] ERROR: %s line %d IP_ADD_MEMBERSHIP %m", __FILE__,
__LINE__);
exit (EXIT_FAILURE);
}
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_addr.s_addr = inet_addr (multicast_group_list[group]);
group_list[group].sock_remote_addr.sin_port = htons (group_list[group].port);
}
}
......
......@@ -189,6 +189,8 @@ double compute_sinr(channel_desc_t *desc,
struct complex S_i1;
struct complex S_i2;
DevAssert( nb_rb > 0 );
avg_sinr=0.0;
// printf("nb_rb %d\n",nb_rb);
for (f=0;f<2*nb_rb;f++) {
......
......@@ -471,7 +471,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
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->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++) {
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)) {
......
......@@ -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);
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 ++,
"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);
......@@ -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)
))
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;
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) {
&& config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB, &rach_messagePowerOffsetGroupB)))
AssertError (0, parse_errors ++,
"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;
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
T=MGRP/10;
//check the measurement gap and sr prohibit timer
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;
return(0);
}
......
......@@ -95,7 +95,7 @@ void rlc_am_pdu_polling (
rlc_pP->rb_id,
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",
ctxt_pP->frame,
(ctxt_pP->enb_flag) ? "eNB" : "UE",
......
......@@ -967,7 +967,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70;
(*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.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth));
......@@ -1365,7 +1365,8 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id,
// RRCConnectionSetup
// 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_config = CALLOC(1,sizeof(*SRB1_config));
......@@ -2151,8 +2152,9 @@ 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));
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;
MCC_MNC_Digit_t dummy;
......@@ -2312,8 +2314,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
UE_EUTRA_Capability_t *UE_EUTRA_Capability;
char UE_EUTRA_Capability_xer[8192];
size_t size;
FILE *f;
LOG_I(RRC,"Allocating %u bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability));
UE_EUTRA_Capability = CALLOC(1, sizeof(*UE_EUTRA_Capability));
......@@ -2406,11 +2407,13 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
else {
f = fopen(UE_EUTRA_Capability_xer_fname, "r");
FILE* f = fopen(UE_EUTRA_Capability_xer_fname, "r");
assert(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) {
LOG_E(RRC,"UE Capabilities XER file %s is too large\n", UE_EUTRA_Capability_xer_fname);
free( UE_EUTRA_Capability);
return(NULL);
}
......@@ -2469,6 +2472,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
sprintf (&sdu[3 * i], "%02x.", UECapability.sdu[i]);
LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu);
free(sdu);
}
return(&UECapability);
......
......@@ -815,7 +815,8 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config);
// 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_config = CALLOC(1, sizeof(*DRB_config));
......@@ -1395,10 +1396,16 @@ void rrc_eNB_generate_HandoverPreparationInformation(
handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value
handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify!
memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock,
(void *)&eNB_rrc_inst[enb_mod_idP].mib, sizeof(MasterInformationBlock_t));
memcpy((void *)&handoverInfo->as_config.sourceMeasConfig,
(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
memset((void *)&eNB_rrc_inst[enb_mod_idP].handover_info[ue_mod_idP]->as_config.sourceSecurityAlgorithmConfig,
0, sizeof(SecurityAlgorithmConfig_t));
......
......@@ -77,7 +77,7 @@ char* getNetMask (){
}
void setBroadcastAddress (char* baseAddr){
strcpy(baseAddr, baseAddr);
strcpy(broadcastAddr, baseAddr);
}
char* getBroadcastAddress (){
......@@ -219,6 +219,7 @@ int bringInterfaceUp(char *interfaceName, int up)
}
// printf("UP/DOWN OK!\n");
close( sock_fd );
return 0;
}
// non blocking full configuration of the interface (address, net mask, and broadcast mask)
......@@ -283,14 +284,14 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask,
command[0]='\0';
strcat(command, "ifconfig ");
strcat(command, interfaceName);
strcat(command, " ");
strcat(command, ipAddress);
strcat(command, " networkMask ");
strcat(command, networkMask);
strcat(command, " broadcast ");
strcat(command, broadcastAddress);
strncat(command, interfaceName, sizeof(command) - strlen(command) - 1);
strncat(command, " ", sizeof(command) - strlen(command) - 1);
strncat(command, ipAddress, sizeof(command) - strlen(command) - 1);
strncat(command, " networkMask ", sizeof(command) - strlen(command) - 1);
strncat(command, networkMask, sizeof(command) - strlen(command) - 1);
strncat(command, " broadcast ", sizeof(command) - strlen(command) - 1);
strncat(command, broadcastAddress, sizeof(command) - strlen(command) - 1);
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
int i = system (command);
......
......@@ -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);
......
......@@ -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] = "";
......
......@@ -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);
......
......@@ -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);
......
......@@ -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_) {
......
......@@ -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;
}
}
......@@ -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;
}
......@@ -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 );
}
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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 );
......
......@@ -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;
......
......@@ -97,7 +97,9 @@ void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void*
intps=time(NULL);
pdh = localtime(&intps);
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
char *heure = NULL;
int heure_int;
......@@ -111,11 +113,14 @@ void schedule_delayed(Operation_Type_t op, Event_Type_t type, char * key, void*
char *minute = NULL;
heure = strtok(date_cpy,"h");
//heure = strchr(date,'h');
printf("heure char : %s", heure);
printf("hour char : %s", heure);
minute = strchr(date,'h');
printf("minute char : %s", minute+1);
free( date_cpy );
date_cpy = 0;
heure_int = atoi(heure);
minute_int = atoi(minute+1);
......@@ -451,7 +456,7 @@ void update_mac(Event_t 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;
LOG_I(EMU,"update complete mac params \n");
if(event.ue == -1 && event.lcid == -1)
......@@ -571,12 +576,12 @@ void update_mac(Event_t event) {
}
else
{
Mac_config* mac_config = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value;
LOG_I(EMU,"update complete mac params \n");
i = event.ue;
int j = event.lcid;
Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value;
LOG_I(EMU,"update complete mac params \n");
i = event.ue;
int j = event.lcid;
if(&mac_config[i].DCI_aggregation_min)
{
LOG_I(EMU,"update dci aggregation min\n");
......@@ -694,7 +699,7 @@ void update_mac(Event_t 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;
int j=0;
LOG_I(EMU,"priority update \n");
......@@ -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))
{
Mac_config* mac_config = malloc(sizeof(Mac_config)*16);
Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value;
LOG_I(EMU,"DCI_aggregation_min update \n");
......@@ -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))
{
Mac_config* mac_config = malloc(sizeof(Mac_config)*16);
Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value;
......@@ -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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -815,7 +820,7 @@ void update_mac(Event_t 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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -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))
{
Mac_config* mac_config = malloc(sizeof(Mac_config)*16);
Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
mac_config = (Mac_config *) event.value;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -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];
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]);
}
}
......@@ -923,7 +928,7 @@ void update_mac(Event_t 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;
LOG_I(EMU,"ue_AggregatedMaximumBitrateDL update \n");
......@@ -950,7 +955,7 @@ void update_mac(Event_t 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;
LOG_I(EMU,"ue_AggregatedMaximumBitrateUL update \n");
......@@ -976,7 +981,7 @@ void update_mac(Event_t 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;
LOG_I(EMU,"cqiSchedInterval update \n");
......@@ -1001,7 +1006,7 @@ void update_mac(Event_t 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;
LOG_I(EMU,"mac_ContentionResolutionTimer update \n");
if(event.ue == -1)
......@@ -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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -1063,10 +1068,8 @@ void update_mac(Event_t 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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -2611,7 +2614,7 @@ int validate_mac(Event_t event)
int i=0;
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;
if(event.ue == -1 && event.lcid == -1)
......@@ -2724,7 +2727,7 @@ int validate_mac(Event_t event)
{
//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;
i = event.ue;
......@@ -2824,7 +2827,7 @@ int validate_mac(Event_t event)
//printf("check one param");
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;
int j=0;
if(event.ue == -1 && event.lcid ==-1)
......@@ -2857,7 +2860,7 @@ int validate_mac(Event_t event)
}
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;
if(event.ue == -1)
......@@ -2883,7 +2886,7 @@ int validate_mac(Event_t event)
}
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;
......@@ -2911,7 +2914,7 @@ int validate_mac(Event_t event)
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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -2945,7 +2948,7 @@ int validate_mac(Event_t event)
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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -3014,8 +3017,8 @@ int validate_mac(Event_t event)
else if(!strcmp((char *) event.key, "min_dl_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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -3048,7 +3051,7 @@ int validate_mac(Event_t event)
}
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;
LOG_I(EMU,"ue_AggregatedMaximumBitrateDL update \n");
......@@ -3072,7 +3075,7 @@ int validate_mac(Event_t event)
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;
......@@ -3095,7 +3098,7 @@ int validate_mac(Event_t event)
}
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;
if(event.ue == -1)
......@@ -3115,7 +3118,7 @@ int validate_mac(Event_t event)
}
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;
if(event.ue == -1)
......@@ -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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......@@ -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;
int j=0;
if(event.ue == -1 && event.lcid == -1)
......
......@@ -736,8 +736,12 @@ int ocg_config_app(void){
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_destination_id, oai_emulation.application_config.predefined_traffic.destination_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]);
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_format2 = strstr(tmp_source_id, comma);
check_format1_dst = strstr(tmp_destination_id, colon);
......@@ -1162,7 +1166,7 @@ int ocg_config_emu(void){
if (oai_emulation.info.opt_enabled == 1) {
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;
} else {
radio_type = RADIO_TYPE_TDD;
......
......@@ -388,8 +388,10 @@ void get_simulation_options(int argc, char *argv[]) {
break;
case 'c':
strcpy(oai_emulation.info.local_server, optarg);
oai_emulation.info.ocg_enabled=1;
//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;
break;
case 'C':
......
......@@ -625,7 +625,7 @@ void get_MIESM_param() {
}
}
}
fclose(fp);
for (t = 0; t < 162; 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]);
......@@ -645,7 +645,7 @@ void get_MIESM_param() {
}
}
}
fclose(fp);
for (t = 0; t < 197; 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]);
......@@ -667,7 +667,7 @@ void get_MIESM_param() {
}
}
}
fclose(fp);
for (t = 0; t < 227; 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]);
......@@ -681,6 +681,7 @@ void get_MIESM_param() {
}
}
fclose(fp);
}
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