From a5b7dcdf1681435cc02ca543e408662f30730889 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Sun, 16 Feb 2020 21:32:49 +0100 Subject: [PATCH] Remove boost string (#936) * Remove boost string * Make sure that int/enc algos can be specified in capital case in the MME. * Use == instead of compare for comparing strings with const chars Co-authored-by: Pedro Alvarez --- srsenb/src/enb.cc | 4 +--- srsepc/src/main.cc | 26 ++++++++++++-------------- srsepc/src/mbms-gw/main.cc | 5 +---- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 0ec7c412d..28e9758c8 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -24,9 +24,7 @@ #include "srsenb/hdr/stack/enb_stack_lte.h" #include "srsenb/src/enb_cfg_parser.h" #include "srslte/build_info.h" -#include #include -#include namespace srsenb { @@ -183,7 +181,7 @@ bool enb::get_metrics(enb_metrics_t* m) srslte::LOG_LEVEL_ENUM enb::level(std::string l) { - boost::to_upper(l); + std::transform(l.begin(), l.end(), l.begin(), ::toupper); if ("NONE" == l) { return srslte::LOG_LEVEL_NONE; } else if ("ERROR" == l) { diff --git a/srsepc/src/main.cc b/srsepc/src/main.cc index 133868fc5..8422bb47c 100644 --- a/srsepc/src/main.cc +++ b/srsepc/src/main.cc @@ -26,13 +26,9 @@ #include "srslte/common/bcd_helpers.h" #include "srslte/common/config_file.h" #include "srslte/common/crash_handler.h" -#include #include -#include -#include #include #include -#include using namespace std; using namespace srsepc; @@ -242,13 +238,14 @@ void parse_args(all_args_t* args, int argc, char* argv[]) cout << "Error parsing mme.mnc:" << mnc << " - must be a 2 or 3-digit string." << endl; } - if (boost::iequals(encryption_algo, "eea0")) { + std::transform(encryption_algo.begin(), encryption_algo.end(), encryption_algo.begin(), ::tolower); + if (encryption_algo == "eea0") { args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_EEA0; - } else if (boost::iequals(encryption_algo, "eea1")) { + } else if (encryption_algo == "eea1") { args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_128_EEA1; - } else if (boost::iequals(encryption_algo, "eea2")) { + } else if (encryption_algo == "eea2") { args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_128_EEA2; - } else if (boost::iequals(encryption_algo, "eea3")) { + } else if (encryption_algo == "eea3") { args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_128_EEA3; } else { args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_EEA0; @@ -256,15 +253,16 @@ void parse_args(all_args_t* args, int argc, char* argv[]) cout << "Using default mme.encryption_algo: EEA0" << endl; } - if (boost::iequals(integrity_algo, "eia0")) { + std::transform(integrity_algo.begin(), integrity_algo.end(), integrity_algo.begin(), ::tolower); + if (integrity_algo == "eia0") { args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_EIA0; cout << "Warning parsing mme.integrity_algo:" << encryption_algo << " - EIA0 will not supported by UEs use EIA1 or EIA2" << endl; - } else if (boost::iequals(integrity_algo, "eia1")) { + } else if (integrity_algo == "eia1") { args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA1; - } else if (boost::iequals(integrity_algo, "eia2")) { + } else if (integrity_algo == "eia2") { args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA2; - } else if (boost::iequals(integrity_algo, "eia3")) { + } else if (integrity_algo == "eia3") { args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA3; } else { args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA1; @@ -344,7 +342,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) srslte::LOG_LEVEL_ENUM level(std::string l) { - boost::to_upper(l); + std::transform(l.begin(), l.end(), l.begin(), ::toupper); if ("NONE" == l) { return srslte::LOG_LEVEL_NONE; } else if ("ERROR" == l) { @@ -400,7 +398,7 @@ int main(int argc, char* argv[]) srslte::logger* logger; /*Init logger*/ - if (!args.log_args.filename.compare("stdout")) { + if (args.log_args.filename == "stdout") { logger = &logger_stdout; } else { logger_file.init(args.log_args.filename); diff --git a/srsepc/src/mbms-gw/main.cc b/srsepc/src/mbms-gw/main.cc index c14a29f94..efa9bf26b 100644 --- a/srsepc/src/mbms-gw/main.cc +++ b/srsepc/src/mbms-gw/main.cc @@ -20,10 +20,7 @@ */ #include "srsepc/hdr/mbms-gw/mbms-gw.h" #include "srslte/common/config_file.h" -#include #include -#include -#include #include #include @@ -53,7 +50,7 @@ typedef struct { srslte::LOG_LEVEL_ENUM level(std::string l) { - boost::to_upper(l); + std::transform(l.begin(), l.end(), l.begin(), ::toupper); if ("NONE" == l) { return srslte::LOG_LEVEL_NONE; } else if ("ERROR" == l) {