Commit 3b3c9dae authored by Robert Schmidt's avatar Robert Schmidt

Reformat flexran_agent_handle_stats() for better readability

parent 328448e8
......@@ -242,7 +242,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
//Set the number of UEs and create list with their RNTIs stats configs
report_config.nr_ue = flexran_get_mac_num_ues(mod_id);
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
......@@ -254,7 +254,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
}
//Set the number of CCs and create a list with the cell stats configs
report_config.nr_cc = MAX_NUM_CCs;
report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
report_config.cc_report_type = malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
if (report_config.cc_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
......@@ -276,7 +276,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
/* Need to make sure that the ue flags are saved (Bug) */
if (report_config.nr_ue == 0) {
report_config.nr_ue = 1;
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
report_config.ue_report_type = malloc(sizeof(ue_report_type_t));
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
......@@ -289,8 +289,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg);
/* Create a timer */
long timer_id = 0;
flexran_agent_timer_args_t *timer_args;
timer_args = malloc(sizeof(flexran_agent_timer_args_t));
flexran_agent_timer_args_t *timer_args = malloc(sizeof(flexran_agent_timer_args_t));
memset (timer_args, 0, sizeof(flexran_agent_timer_args_t));
timer_args->mod_id = enb_id;
timer_args->msg = timer_msg;
......@@ -302,7 +301,9 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
sec_interval = usec_interval/(1000*1000);
usec_interval = usec_interval%(1000*1000);
}
flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id);
flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT,
enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid,
flexran_agent_handle_timed_task,(void*) timer_args, &timer_id);
} else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) {
/*If request was for continuous updates, disable the previous configuration and
set up a new one*/
......@@ -314,7 +315,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
/* Need to make sure that the ue flags are saved (Bug) */
if (report_config.nr_ue == 0) {
report_config.nr_ue = 1;
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
report_config.ue_report_type = malloc(sizeof(ue_report_type_t));
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
......@@ -334,7 +335,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
report_config.nr_ue = 0;
report_config.ue_report_type = NULL;
report_config.nr_cc = cell_req->n_cell;
report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
report_config.cc_report_type = malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
if (report_config.cc_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
......@@ -352,7 +353,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
report_config.nr_cc = 0;
report_config.cc_report_type = NULL;
report_config.nr_ue = ue_req->n_rnti;
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
......@@ -369,7 +370,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
goto error;
}
if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )){
if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
......
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