Changed enb_cfg_parcer.cc to use SRSRAN_ERROR instead of -1 for error returning.

master
Pedro Alvarez 3 years ago committed by Ismael Gomez
parent e19df2aedb
commit 17c09dfd75

@ -73,7 +73,7 @@ int field_sched_info::parse(libconfig::Setting& root)
for (uint32_t i = 0; i < data->sched_info_list.size(); i++) { for (uint32_t i = 0; i < data->sched_info_list.size(); i++) {
if (not parse_enum_by_number(data->sched_info_list[i].si_periodicity, "si_periodicity", root[i])) { if (not parse_enum_by_number(data->sched_info_list[i].si_periodicity, "si_periodicity", root[i])) {
fprintf(stderr, "Missing field si_periodicity in sched_info=%d\n", i); fprintf(stderr, "Missing field si_periodicity in sched_info=%d\n", i);
return -1; return SRSRAN_ERROR;
} }
if (root[i].exists("si_mapping_info")) { if (root[i].exists("si_mapping_info")) {
data->sched_info_list[i].sib_map_info.resize((uint32_t)root[i]["si_mapping_info"].getLength()); data->sched_info_list[i].sib_map_info.resize((uint32_t)root[i]["si_mapping_info"].getLength());
@ -84,12 +84,12 @@ int field_sched_info::parse(libconfig::Setting& root)
data->sched_info_list[i].sib_map_info[j].value = (sib_type_e::options)(sib_index - 3); data->sched_info_list[i].sib_map_info[j].value = (sib_type_e::options)(sib_index - 3);
} else { } else {
fprintf(stderr, "Invalid SIB index %d for si_mapping_info=%d in sched_info=%d\n", sib_index, j, i); fprintf(stderr, "Invalid SIB index %d for si_mapping_info=%d in sched_info=%d\n", sib_index, j, i);
return -1; return SRSRAN_ERROR;
} }
} }
} else { } else {
fprintf(stderr, "Number of si_mapping_info values exceeds maximum (%d)\n", ASN1_RRC_MAX_SIB); fprintf(stderr, "Number of si_mapping_info values exceeds maximum (%d)\n", ASN1_RRC_MAX_SIB);
return -1; return SRSRAN_ERROR;
} }
} else { } else {
data->sched_info_list[i].sib_map_info.resize(0); data->sched_info_list[i].sib_map_info.resize(0);
@ -105,13 +105,13 @@ int field_intra_neigh_cell_list::parse(libconfig::Setting& root)
for (uint32_t i = 0; i < data->intra_freq_neigh_cell_list.size() && i < ASN1_RRC_MAX_CELL_INTRA; i++) { for (uint32_t i = 0; i < data->intra_freq_neigh_cell_list.size() && i < ASN1_RRC_MAX_CELL_INTRA; i++) {
if (not parse_enum_by_number(data->intra_freq_neigh_cell_list[i].q_offset_cell, "q_offset_range", root[i])) { if (not parse_enum_by_number(data->intra_freq_neigh_cell_list[i].q_offset_cell, "q_offset_range", root[i])) {
fprintf(stderr, "Missing field q_offset_range in neigh_cell=%d\n", i); fprintf(stderr, "Missing field q_offset_range in neigh_cell=%d\n", i);
return -1; return SRSRAN_ERROR;
} }
int phys_cell_id = 0; int phys_cell_id = 0;
if (!root[i].lookupValue("phys_cell_id", phys_cell_id)) { if (!root[i].lookupValue("phys_cell_id", phys_cell_id)) {
fprintf(stderr, "Missing field phys_cell_id in neigh_cell=%d\n", i); fprintf(stderr, "Missing field phys_cell_id in neigh_cell=%d\n", i);
return -1; return SRSRAN_ERROR;
} }
data->intra_freq_neigh_cell_list[i].pci = (uint16)phys_cell_id; data->intra_freq_neigh_cell_list[i].pci = (uint16)phys_cell_id;
} }
@ -125,14 +125,14 @@ int field_intra_black_cell_list::parse(libconfig::Setting& root)
for (uint32_t i = 0; i < data->intra_freq_black_cell_list.size() && i < ASN1_RRC_MAX_CELL_BLACK; i++) { for (uint32_t i = 0; i < data->intra_freq_black_cell_list.size() && i < ASN1_RRC_MAX_CELL_BLACK; i++) {
if (not parse_enum_by_number(data->intra_freq_black_cell_list[i].range, "range", root[i])) { if (not parse_enum_by_number(data->intra_freq_black_cell_list[i].range, "range", root[i])) {
fprintf(stderr, "Missing field range in black_cell=%d\n", i); fprintf(stderr, "Missing field range in black_cell=%d\n", i);
return -1; return SRSRAN_ERROR;
} }
data->intra_freq_black_cell_list[i].range_present = true; data->intra_freq_black_cell_list[i].range_present = true;
int start = 0; int start = 0;
if (!root[i].lookupValue("start", start)) { if (!root[i].lookupValue("start", start)) {
fprintf(stderr, "Missing field start in black_cell=%d\n", i); fprintf(stderr, "Missing field start in black_cell=%d\n", i);
return -1; return SRSRAN_ERROR;
} }
data->intra_freq_black_cell_list[i].start = (uint16)start; data->intra_freq_black_cell_list[i].start = (uint16)start;
} }
@ -145,7 +145,7 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root)
data->carrier_freqs_info_list_present = data->carrier_freqs_info_list.size() > 0; data->carrier_freqs_info_list_present = data->carrier_freqs_info_list.size() > 0;
if (data->carrier_freqs_info_list.size() > ASN1_RRC_MAX_GNFG) { if (data->carrier_freqs_info_list.size() > ASN1_RRC_MAX_GNFG) {
ERROR("CarrierFreqsInfoGERAN cannot have more than %d entries", ASN1_RRC_MAX_GNFG); ERROR("CarrierFreqsInfoGERAN cannot have more than %d entries", ASN1_RRC_MAX_GNFG);
return -1; return SRSRAN_ERROR;
} }
for (uint32_t i = 0; i < data->carrier_freqs_info_list.size(); i++) { for (uint32_t i = 0; i < data->carrier_freqs_info_list.size(); i++) {
int cell_resel_prio; int cell_resel_prio;
@ -164,27 +164,27 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root)
"ncc_permitted", &data->carrier_freqs_info_list[i].common_info.ncc_permitted); "ncc_permitted", &data->carrier_freqs_info_list[i].common_info.ncc_permitted);
if (ncc_permitted.parse(root[i])) { if (ncc_permitted.parse(root[i])) {
ERROR("Error parsing `ncc_permitted` in carrier_freqs_info_lsit=%d", i); ERROR("Error parsing `ncc_permitted` in carrier_freqs_info_lsit=%d", i);
return -1; return SRSRAN_ERROR;
} }
int q_rx_lev_min = 0; int q_rx_lev_min = 0;
if (!root[i].lookupValue("q_rx_lev_min", q_rx_lev_min)) { if (!root[i].lookupValue("q_rx_lev_min", q_rx_lev_min)) {
ERROR("Missing field `q_rx_lev_min` in carrier_freqs_info_list=%d", i); ERROR("Missing field `q_rx_lev_min` in carrier_freqs_info_list=%d", i);
return -1; return SRSRAN_ERROR;
} }
data->carrier_freqs_info_list[i].common_info.q_rx_lev_min = q_rx_lev_min; data->carrier_freqs_info_list[i].common_info.q_rx_lev_min = q_rx_lev_min;
int thresh_x_high = 0; int thresh_x_high = 0;
if (!root[i].lookupValue("thresh_x_high", thresh_x_high)) { if (!root[i].lookupValue("thresh_x_high", thresh_x_high)) {
ERROR("Missing field `thresh_x_high` in carrier_freqs_info_list=%d", i); ERROR("Missing field `thresh_x_high` in carrier_freqs_info_list=%d", i);
return -1; return SRSRAN_ERROR;
} }
data->carrier_freqs_info_list[i].common_info.thresh_x_high = thresh_x_high; data->carrier_freqs_info_list[i].common_info.thresh_x_high = thresh_x_high;
int thresh_x_low = 0; int thresh_x_low = 0;
if (!root[i].lookupValue("thresh_x_low", thresh_x_low)) { if (!root[i].lookupValue("thresh_x_low", thresh_x_low)) {
ERROR("Missing field `thresh_x_low` in carrier_freqs_info_list=%d", i); ERROR("Missing field `thresh_x_low` in carrier_freqs_info_list=%d", i);
return -1; return SRSRAN_ERROR;
} }
data->carrier_freqs_info_list[i].common_info.thresh_x_low = thresh_x_low; data->carrier_freqs_info_list[i].common_info.thresh_x_low = thresh_x_low;
@ -197,7 +197,7 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root)
&data->carrier_freqs_info_list[i].carrier_freqs.band_ind); &data->carrier_freqs_info_list[i].carrier_freqs.band_ind);
if (band_ind.parse(root[i])) { if (band_ind.parse(root[i])) {
ERROR("Error parsing `band_ind` in carrier_freqs_info_list=%d", i); ERROR("Error parsing `band_ind` in carrier_freqs_info_list=%d", i);
return -1; return SRSRAN_ERROR;
} }
data->carrier_freqs_info_list[i].carrier_freqs.following_arfcns.set_explicit_list_of_arfcns(); data->carrier_freqs_info_list[i].carrier_freqs.following_arfcns.set_explicit_list_of_arfcns();
@ -213,12 +213,12 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root)
exp_l[j] = (short unsigned int)arfcn; exp_l[j] = (short unsigned int)arfcn;
} else { } else {
fprintf(stderr, "Invalid ARFCN %d in for carrier_freqs_info_list=%d explicit_list_of_arfcns\n", i, j); fprintf(stderr, "Invalid ARFCN %d in for carrier_freqs_info_list=%d explicit_list_of_arfcns\n", i, j);
return -1; return SRSRAN_ERROR;
} }
} }
} else { } else {
fprintf(stderr, "Number of ARFCN in explicit_list_of_arfcns exceeds maximum (%d)\n", 31); fprintf(stderr, "Number of ARFCN in explicit_list_of_arfcns exceeds maximum (%d)\n", 31);
return -1; return SRSRAN_ERROR;
} }
} else { } else {
exp_l.resize(0); exp_l.resize(0);
@ -264,7 +264,7 @@ int mbsfn_sf_cfg_list_parser::parse(Setting& root)
} }
if (len > 1) { if (len > 1) {
fprintf(stderr, "Only mbsfnSubframeConfigListLengths of size 1 are supported\n"); fprintf(stderr, "Only mbsfnSubframeConfigListLengths of size 1 are supported\n");
return -1; return SRSRAN_ERROR;
} }
*enabled = true; *enabled = true;
mbsfn_list->resize(len); mbsfn_list->resize(len);
@ -306,53 +306,53 @@ int mbsfn_area_info_list_parser::parse(Setting& root)
&mbsfn_item->non_mbsfn_region_len); &mbsfn_item->non_mbsfn_region_len);
if (fieldlen.parse(root["mbsfn_area_info_list"])) { if (fieldlen.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing non_mbsfn_region_length\n"); fprintf(stderr, "Error parsing non_mbsfn_region_length\n");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_str<mbsfn_area_info_r9_s::mcch_cfg_r9_s_::mcch_repeat_period_r9_e_> repeat( field_asn1_enum_str<mbsfn_area_info_r9_s::mcch_cfg_r9_s_::mcch_repeat_period_r9_e_> repeat(
"mcch_repetition_period", &mbsfn_item->mcch_cfg_r9.mcch_repeat_period_r9); "mcch_repetition_period", &mbsfn_item->mcch_cfg_r9.mcch_repeat_period_r9);
if (repeat.parse(root["mbsfn_area_info_list"])) { if (repeat.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing mcch_repetition_period\n"); fprintf(stderr, "Error parsing mcch_repetition_period\n");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_str<mbsfn_area_info_r9_s::mcch_cfg_r9_s_::mcch_mod_period_r9_e_> mod( field_asn1_enum_str<mbsfn_area_info_r9_s::mcch_cfg_r9_s_::mcch_mod_period_r9_e_> mod(
"mcch_modification_period", &mbsfn_item->mcch_cfg_r9.mcch_mod_period_r9); "mcch_modification_period", &mbsfn_item->mcch_cfg_r9.mcch_mod_period_r9);
if (mod.parse(root["mbsfn_area_info_list"])) { if (mod.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing mcch_modification_period\n"); fprintf(stderr, "Error parsing mcch_modification_period\n");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_str<mbsfn_area_info_r9_s::mcch_cfg_r9_s_::sig_mcs_r9_e_> sig("signalling_mcs", field_asn1_enum_str<mbsfn_area_info_r9_s::mcch_cfg_r9_s_::sig_mcs_r9_e_> sig("signalling_mcs",
&mbsfn_item->mcch_cfg_r9.sig_mcs_r9); &mbsfn_item->mcch_cfg_r9.sig_mcs_r9);
if (sig.parse(root["mbsfn_area_info_list"])) { if (sig.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing signalling_mcs\n"); fprintf(stderr, "Error parsing signalling_mcs\n");
return -1; return SRSRAN_ERROR;
} }
parser::field<uint16_t> areaid("mbsfn_area_id", &mbsfn_item->mbsfn_area_id_r9); parser::field<uint16_t> areaid("mbsfn_area_id", &mbsfn_item->mbsfn_area_id_r9);
if (areaid.parse(root["mbsfn_area_info_list"])) { if (areaid.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing mbsfn_area_id\n"); fprintf(stderr, "Error parsing mbsfn_area_id\n");
return -1; return SRSRAN_ERROR;
} }
parser::field<uint8_t> notif_ind("notification_indicator", &mbsfn_item->notif_ind_r9); parser::field<uint8_t> notif_ind("notification_indicator", &mbsfn_item->notif_ind_r9);
if (notif_ind.parse(root["mbsfn_area_info_list"])) { if (notif_ind.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing notification_indicator\n"); fprintf(stderr, "Error parsing notification_indicator\n");
return -1; return SRSRAN_ERROR;
} }
parser::field<uint8_t> offset("mcch_offset", &mbsfn_item->mcch_cfg_r9.mcch_offset_r9); parser::field<uint8_t> offset("mcch_offset", &mbsfn_item->mcch_cfg_r9.mcch_offset_r9);
if (offset.parse(root["mbsfn_area_info_list"])) { if (offset.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing mcch_offset\n"); fprintf(stderr, "Error parsing mcch_offset\n");
return -1; return SRSRAN_ERROR;
} }
field_asn1_bitstring_number<asn1::fixed_bitstring<6>, uint8_t> alloc_info("sf_alloc_info", field_asn1_bitstring_number<asn1::fixed_bitstring<6>, uint8_t> alloc_info("sf_alloc_info",
&mbsfn_item->mcch_cfg_r9.sf_alloc_info_r9); &mbsfn_item->mcch_cfg_r9.sf_alloc_info_r9);
if (alloc_info.parse(root["mbsfn_area_info_list"])) { if (alloc_info.parse(root["mbsfn_area_info_list"])) {
fprintf(stderr, "Error parsing mbsfn_area_info_list\n"); fprintf(stderr, "Error parsing mbsfn_area_info_list\n");
return -1; return SRSRAN_ERROR;
} }
return 0; return 0;
@ -386,13 +386,13 @@ int phr_cnfg_parser::parse(libconfig::Setting& root)
mac_main_cfg_s::phr_cfg_c_::setup_s_& s = phr_cfg->setup(); mac_main_cfg_s::phr_cfg_c_::setup_s_& s = phr_cfg->setup();
if (not parse_enum_by_str(s.dl_pathloss_change, "dl_pathloss_change", root["phr_cnfg"])) { if (not parse_enum_by_str(s.dl_pathloss_change, "dl_pathloss_change", root["phr_cnfg"])) {
return -1; return SRSRAN_ERROR;
} }
if (not parse_enum_by_number(s.periodic_phr_timer, "periodic_phr_timer", root["phr_cnfg"])) { if (not parse_enum_by_number(s.periodic_phr_timer, "periodic_phr_timer", root["phr_cnfg"])) {
return -1; return SRSRAN_ERROR;
} }
if (not parse_enum_by_number(s.prohibit_phr_timer, "prohibit_phr_timer", root["phr_cnfg"])) { if (not parse_enum_by_number(s.prohibit_phr_timer, "prohibit_phr_timer", root["phr_cnfg"])) {
return -1; return SRSRAN_ERROR;
} }
return 0; return 0;
} }
@ -410,7 +410,7 @@ int field_srb::parse(libconfig::Setting& root)
// RLC-UM Should not exist section // RLC-UM Should not exist section
if (q["rlc_config"].exists("ul_um") || q["rlc_config"].exists("dl_um")) { if (q["rlc_config"].exists("ul_um") || q["rlc_config"].exists("dl_um")) {
ERROR("Error SRBs must be AM."); ERROR("Error SRBs must be AM.");
return -1; return SRSRAN_ERROR;
} }
// Parse RLC-AM section // Parse RLC-AM section
@ -420,25 +420,25 @@ int field_srb::parse(libconfig::Setting& root)
field_asn1_enum_number<t_poll_retx_e> t_poll_retx("t_poll_retx", &am_rlc->t_poll_retx); field_asn1_enum_number<t_poll_retx_e> t_poll_retx("t_poll_retx", &am_rlc->t_poll_retx);
if (t_poll_retx.parse(q["rlc_config"]["ul_am"])) { if (t_poll_retx.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find t_poll_retx in section ul_am"); ERROR("Error can't find t_poll_retx in section ul_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<poll_pdu_e> poll_pdu("poll_pdu", &am_rlc->poll_pdu); field_asn1_enum_number<poll_pdu_e> poll_pdu("poll_pdu", &am_rlc->poll_pdu);
if (poll_pdu.parse(q["rlc_config"]["ul_am"])) { if (poll_pdu.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find poll_pdu in section ul_am"); ERROR("Error can't find poll_pdu in section ul_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<poll_byte_e> poll_byte("poll_byte", &am_rlc->poll_byte); field_asn1_enum_number<poll_byte_e> poll_byte("poll_byte", &am_rlc->poll_byte);
if (poll_byte.parse(q["rlc_config"]["ul_am"])) { if (poll_byte.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find poll_byte in section ul_am"); ERROR("Error can't find poll_byte in section ul_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<ul_am_rlc_s::max_retx_thres_e_> max_retx_thresh("max_retx_thresh", &am_rlc->max_retx_thres); field_asn1_enum_number<ul_am_rlc_s::max_retx_thres_e_> max_retx_thresh("max_retx_thresh", &am_rlc->max_retx_thres);
if (max_retx_thresh.parse(q["rlc_config"]["ul_am"])) { if (max_retx_thresh.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find max_retx_thresh in section ul_am"); ERROR("Error can't find max_retx_thresh in section ul_am");
return -1; return SRSRAN_ERROR;
} }
} }
@ -448,13 +448,13 @@ int field_srb::parse(libconfig::Setting& root)
field_asn1_enum_number<t_reordering_e> t_reordering("t_reordering", &am_rlc->t_reordering); field_asn1_enum_number<t_reordering_e> t_reordering("t_reordering", &am_rlc->t_reordering);
if (t_reordering.parse(q["rlc_config"]["dl_am"])) { if (t_reordering.parse(q["rlc_config"]["dl_am"])) {
ERROR("Error can't find t_reordering in section dl_am"); ERROR("Error can't find t_reordering in section dl_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<t_status_prohibit_e> t_status_prohibit("t_status_prohibit", &am_rlc->t_status_prohibit); field_asn1_enum_number<t_status_prohibit_e> t_status_prohibit("t_status_prohibit", &am_rlc->t_status_prohibit);
if (t_status_prohibit.parse(q["rlc_config"]["dl_am"])) { if (t_status_prohibit.parse(q["rlc_config"]["dl_am"])) {
ERROR("Error can't find t_status_prohibit in section dl_am"); ERROR("Error can't find t_status_prohibit in section dl_am");
return -1; return SRSRAN_ERROR;
} }
} }
return 0; return 0;
@ -472,7 +472,7 @@ int field_qci::parse(libconfig::Setting& root)
// Parse PDCP section // Parse PDCP section
if (!q.exists("pdcp_config")) { if (!q.exists("pdcp_config")) {
fprintf(stderr, "Error section pdcp_config not found for qci=%d\n", qci); fprintf(stderr, "Error section pdcp_config not found for qci=%d\n", qci);
return -1; return SRSRAN_ERROR;
} }
rrc_cfg_qci_t qcicfg; rrc_cfg_qci_t qcicfg;
@ -501,7 +501,7 @@ int field_qci::parse(libconfig::Setting& root)
rlc_cfg->set_um_uni_dir_dl(); rlc_cfg->set_um_uni_dir_dl();
} else { } else {
fprintf(stderr, "Invalid combination of UL/DL UM/AM for qci=%d\n", qci); fprintf(stderr, "Invalid combination of UL/DL UM/AM for qci=%d\n", qci);
return -1; return SRSRAN_ERROR;
} }
// Parse RLC-UM section // Parse RLC-UM section
@ -516,7 +516,7 @@ int field_qci::parse(libconfig::Setting& root)
field_asn1_enum_number<sn_field_len_e> sn_field_len("sn_field_length", &um_rlc->sn_field_len); field_asn1_enum_number<sn_field_len_e> sn_field_len("sn_field_length", &um_rlc->sn_field_len);
if (sn_field_len.parse(q["rlc_config"]["ul_um"])) { if (sn_field_len.parse(q["rlc_config"]["ul_um"])) {
ERROR("Error can't find sn_field_length in section ul_um"); ERROR("Error can't find sn_field_length in section ul_um");
return -1; return SRSRAN_ERROR;
} }
} }
@ -531,13 +531,13 @@ int field_qci::parse(libconfig::Setting& root)
field_asn1_enum_number<sn_field_len_e> sn_field_len("sn_field_length", &um_rlc->sn_field_len); field_asn1_enum_number<sn_field_len_e> sn_field_len("sn_field_length", &um_rlc->sn_field_len);
if (sn_field_len.parse(q["rlc_config"]["dl_um"])) { if (sn_field_len.parse(q["rlc_config"]["dl_um"])) {
ERROR("Error can't find sn_field_length in section dl_um"); ERROR("Error can't find sn_field_length in section dl_um");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<t_reordering_e> t_reordering("t_reordering", &um_rlc->t_reordering); field_asn1_enum_number<t_reordering_e> t_reordering("t_reordering", &um_rlc->t_reordering);
if (t_reordering.parse(q["rlc_config"]["dl_um"])) { if (t_reordering.parse(q["rlc_config"]["dl_um"])) {
ERROR("Error can't find t_reordering in section dl_um"); ERROR("Error can't find t_reordering in section dl_um");
return -1; return SRSRAN_ERROR;
} }
} }
@ -548,26 +548,26 @@ int field_qci::parse(libconfig::Setting& root)
field_asn1_enum_number<t_poll_retx_e> t_poll_retx("t_poll_retx", &am_rlc->t_poll_retx); field_asn1_enum_number<t_poll_retx_e> t_poll_retx("t_poll_retx", &am_rlc->t_poll_retx);
if (t_poll_retx.parse(q["rlc_config"]["ul_am"])) { if (t_poll_retx.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find t_poll_retx in section ul_am"); ERROR("Error can't find t_poll_retx in section ul_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<poll_pdu_e> poll_pdu("poll_pdu", &am_rlc->poll_pdu); field_asn1_enum_number<poll_pdu_e> poll_pdu("poll_pdu", &am_rlc->poll_pdu);
if (poll_pdu.parse(q["rlc_config"]["ul_am"])) { if (poll_pdu.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find poll_pdu in section ul_am"); ERROR("Error can't find poll_pdu in section ul_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<poll_byte_e> poll_byte("poll_byte", &am_rlc->poll_byte); field_asn1_enum_number<poll_byte_e> poll_byte("poll_byte", &am_rlc->poll_byte);
if (poll_byte.parse(q["rlc_config"]["ul_am"])) { if (poll_byte.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find poll_byte in section ul_am"); ERROR("Error can't find poll_byte in section ul_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<ul_am_rlc_s::max_retx_thres_e_> max_retx_thresh("max_retx_thresh", field_asn1_enum_number<ul_am_rlc_s::max_retx_thres_e_> max_retx_thresh("max_retx_thresh",
&am_rlc->max_retx_thres); &am_rlc->max_retx_thres);
if (max_retx_thresh.parse(q["rlc_config"]["ul_am"])) { if (max_retx_thresh.parse(q["rlc_config"]["ul_am"])) {
ERROR("Error can't find max_retx_thresh in section ul_am"); ERROR("Error can't find max_retx_thresh in section ul_am");
return -1; return SRSRAN_ERROR;
} }
} }
@ -577,20 +577,20 @@ int field_qci::parse(libconfig::Setting& root)
field_asn1_enum_number<t_reordering_e> t_reordering("t_reordering", &am_rlc->t_reordering); field_asn1_enum_number<t_reordering_e> t_reordering("t_reordering", &am_rlc->t_reordering);
if (t_reordering.parse(q["rlc_config"]["dl_am"])) { if (t_reordering.parse(q["rlc_config"]["dl_am"])) {
ERROR("Error can't find t_reordering in section dl_am"); ERROR("Error can't find t_reordering in section dl_am");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<t_status_prohibit_e> t_status_prohibit("t_status_prohibit", &am_rlc->t_status_prohibit); field_asn1_enum_number<t_status_prohibit_e> t_status_prohibit("t_status_prohibit", &am_rlc->t_status_prohibit);
if (t_status_prohibit.parse(q["rlc_config"]["dl_am"])) { if (t_status_prohibit.parse(q["rlc_config"]["dl_am"])) {
ERROR("Error can't find t_status_prohibit in section dl_am"); ERROR("Error can't find t_status_prohibit in section dl_am");
return -1; return SRSRAN_ERROR;
} }
} }
// Parse logical channel configuration section // Parse logical channel configuration section
if (!q.exists("logical_channel_config")) { if (!q.exists("logical_channel_config")) {
fprintf(stderr, "Error section logical_channel_config not found for qci=%d\n", qci); fprintf(stderr, "Error section logical_channel_config not found for qci=%d\n", qci);
return -1; return SRSRAN_ERROR;
} }
lc_ch_cfg_s::ul_specific_params_s_* lc_cfg = &qcicfg.lc_cfg; lc_ch_cfg_s::ul_specific_params_s_* lc_cfg = &qcicfg.lc_cfg;
@ -598,21 +598,21 @@ int field_qci::parse(libconfig::Setting& root)
parser::field<uint8> priority("priority", &lc_cfg->prio); parser::field<uint8> priority("priority", &lc_cfg->prio);
if (priority.parse(q["logical_channel_config"])) { if (priority.parse(q["logical_channel_config"])) {
ERROR("Error can't find logical_channel_config in section priority"); ERROR("Error can't find logical_channel_config in section priority");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<lc_ch_cfg_s::ul_specific_params_s_::prioritised_bit_rate_e_> prioritised_bit_rate( field_asn1_enum_number<lc_ch_cfg_s::ul_specific_params_s_::prioritised_bit_rate_e_> prioritised_bit_rate(
"prioritized_bit_rate", &lc_cfg->prioritised_bit_rate); "prioritized_bit_rate", &lc_cfg->prioritised_bit_rate);
if (prioritised_bit_rate.parse(q["logical_channel_config"])) { if (prioritised_bit_rate.parse(q["logical_channel_config"])) {
fprintf(stderr, "Error can't find prioritized_bit_rate in section logical_channel_config\n"); fprintf(stderr, "Error can't find prioritized_bit_rate in section logical_channel_config\n");
return -1; return SRSRAN_ERROR;
} }
field_asn1_enum_number<lc_ch_cfg_s::ul_specific_params_s_::bucket_size_dur_e_> bucket_size_duration( field_asn1_enum_number<lc_ch_cfg_s::ul_specific_params_s_::bucket_size_dur_e_> bucket_size_duration(
"bucket_size_duration", &lc_cfg->bucket_size_dur); "bucket_size_duration", &lc_cfg->bucket_size_dur);
if (bucket_size_duration.parse(q["logical_channel_config"])) { if (bucket_size_duration.parse(q["logical_channel_config"])) {
ERROR("Error can't find bucket_size_duration in section logical_channel_config"); ERROR("Error can't find bucket_size_duration in section logical_channel_config");
return -1; return SRSRAN_ERROR;
} }
parser::field<uint8> log_chan_group("log_chan_group", &lc_cfg->lc_ch_group); parser::field<uint8> log_chan_group("log_chan_group", &lc_cfg->lc_ch_group);
@ -843,7 +843,7 @@ static int parse_cell_list(all_args_t* args, rrc_cfg_t* rrc_cfg, Setting& root)
HANDLEPARSERCODE(parse_meas_cell_list(&cell_cfg.meas_cfg, cellroot["meas_cell_list"])); HANDLEPARSERCODE(parse_meas_cell_list(&cell_cfg.meas_cfg, cellroot["meas_cell_list"]));
if (not cellroot.exists("meas_report_desc")) { if (not cellroot.exists("meas_report_desc")) {
ERROR("PARSER ERROR: \"ho_active\" is set to true, but field \"meas_report_desc\" doesn't exist.\n"); ERROR("PARSER ERROR: \"ho_active\" is set to true, but field \"meas_report_desc\" doesn't exist.\n");
return -1; return SRSRAN_ERROR;
} }
HANDLEPARSERCODE(parse_meas_report_desc(&cell_cfg.meas_cfg, cellroot["meas_report_desc"])); HANDLEPARSERCODE(parse_meas_report_desc(&cell_cfg.meas_cfg, cellroot["meas_report_desc"]));
} }
@ -869,13 +869,13 @@ static int parse_cell_list(all_args_t* args, rrc_cfg_t* rrc_cfg, Setting& root)
// Check RF port is not repeated // Check RF port is not repeated
if (it->rf_port == it2->rf_port) { if (it->rf_port == it2->rf_port) {
ERROR("Repeated RF port for multiple cells"); ERROR("Repeated RF port for multiple cells");
return -1; return SRSRAN_ERROR;
} }
// Check cell ID is not repeated // Check cell ID is not repeated
if (it->cell_id == it2->cell_id) { if (it->cell_id == it2->cell_id) {
ERROR("Repeated Cell identifier"); ERROR("Repeated Cell identifier");
return -1; return SRSRAN_ERROR;
} }
} }
} }
@ -1589,7 +1589,7 @@ int parse_sib9(std::string filename, sib_type9_s* data)
} }
return 0; return 0;
} else { } else {
return -1; return SRSRAN_ERROR;
} }
} }
@ -1635,19 +1635,19 @@ int parse_sibs(all_args_t* args_, rrc_cfg_t* rrc_cfg_, srsenb::phy_cfg_t* phy_co
std::string mnc_str; std::string mnc_str;
if (not srsran::mnc_to_string(args_->stack.s1ap.mnc, &mnc_str)) { if (not srsran::mnc_to_string(args_->stack.s1ap.mnc, &mnc_str)) {
ERROR("The provided mnc=%d is not valid", args_->stack.s1ap.mnc); ERROR("The provided mnc=%d is not valid", args_->stack.s1ap.mnc);
return -1; return SRSRAN_ERROR;
} }
std::string mcc_str; std::string mcc_str;
if (not srsran::mcc_to_string(args_->stack.s1ap.mcc, &mcc_str)) { if (not srsran::mcc_to_string(args_->stack.s1ap.mcc, &mcc_str)) {
ERROR("The provided mnc=%d is not valid", args_->stack.s1ap.mcc); ERROR("The provided mnc=%d is not valid", args_->stack.s1ap.mcc);
return -1; return SRSRAN_ERROR;
} }
sib_type1_s::cell_access_related_info_s_* cell_access = &sib1->cell_access_related_info; sib_type1_s::cell_access_related_info_s_* cell_access = &sib1->cell_access_related_info;
cell_access->plmn_id_list.resize(1); cell_access->plmn_id_list.resize(1);
srsran::plmn_id_t plmn; srsran::plmn_id_t plmn;
if (plmn.from_string(mcc_str + mnc_str) == SRSRAN_ERROR) { if (plmn.from_string(mcc_str + mnc_str) == SRSRAN_ERROR) {
ERROR("Could not convert %s to a plmn_id", (mcc_str + mnc_str).c_str()); ERROR("Could not convert %s to a plmn_id", (mcc_str + mnc_str).c_str());
return -1; return SRSRAN_ERROR;
} }
srsran::to_asn1(&cell_access->plmn_id_list[0].plmn_id, plmn); srsran::to_asn1(&cell_access->plmn_id_list[0].plmn_id, plmn);
cell_access->plmn_id_list[0].cell_reserved_for_oper = plmn_id_info_s::cell_reserved_for_oper_e_::not_reserved; cell_access->plmn_id_list[0].cell_reserved_for_oper = plmn_id_info_s::cell_reserved_for_oper_e_::not_reserved;
@ -1673,7 +1673,7 @@ int parse_sibs(all_args_t* args_, rrc_cfg_t* rrc_cfg_, srsenb::phy_cfg_t* phy_co
// verify SIB13 is available // verify SIB13 is available
if (not sib_is_present(sib1->sched_info_list, sib_type_e::sib_type13_v920)) { if (not sib_is_present(sib1->sched_info_list, sib_type_e::sib_type13_v920)) {
fprintf(stderr, "SIB13 not present in sched_info.\n"); fprintf(stderr, "SIB13 not present in sched_info.\n");
return -1; return SRSRAN_ERROR;
} }
} }

Loading…
Cancel
Save