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 <pedro.alvarez@softwareradiosystems.com>
master
Ismael Gomez 5 years ago committed by GitHub
parent be82e1f368
commit a5b7dcdf16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,9 +24,7 @@
#include "srsenb/hdr/stack/enb_stack_lte.h" #include "srsenb/hdr/stack/enb_stack_lte.h"
#include "srsenb/src/enb_cfg_parser.h" #include "srsenb/src/enb_cfg_parser.h"
#include "srslte/build_info.h" #include "srslte/build_info.h"
#include <boost/algorithm/string.hpp>
#include <iostream> #include <iostream>
#include <sstream>
namespace srsenb { namespace srsenb {
@ -183,7 +181,7 @@ bool enb::get_metrics(enb_metrics_t* m)
srslte::LOG_LEVEL_ENUM enb::level(std::string l) 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) { if ("NONE" == l) {
return srslte::LOG_LEVEL_NONE; return srslte::LOG_LEVEL_NONE;
} else if ("ERROR" == l) { } else if ("ERROR" == l) {

@ -26,13 +26,9 @@
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/config_file.h" #include "srslte/common/config_file.h"
#include "srslte/common/crash_handler.h" #include "srslte/common/crash_handler.h"
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <errno.h>
#include <fstream>
#include <iostream> #include <iostream>
#include <signal.h> #include <signal.h>
#include <sstream>
using namespace std; using namespace std;
using namespace srsepc; 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; 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; 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; 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; 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; args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_128_EEA3;
} else { } else {
args->mme_args.s1ap_args.encryption_algo = srslte::CIPHERING_ALGORITHM_ID_EEA0; 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; 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; args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_EIA0;
cout << "Warning parsing mme.integrity_algo:" << encryption_algo cout << "Warning parsing mme.integrity_algo:" << encryption_algo
<< " - EIA0 will not supported by UEs use EIA1 or EIA2" << endl; << " - 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; 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; 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; args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA3;
} else { } else {
args->mme_args.s1ap_args.integrity_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA1; 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) srslte::LOG_LEVEL_ENUM level(std::string l)
{ {
boost::to_upper(l); std::transform(l.begin(), l.end(), l.begin(), ::toupper);
if ("NONE" == l) { if ("NONE" == l) {
return srslte::LOG_LEVEL_NONE; return srslte::LOG_LEVEL_NONE;
} else if ("ERROR" == l) { } else if ("ERROR" == l) {
@ -400,7 +398,7 @@ int main(int argc, char* argv[])
srslte::logger* logger; srslte::logger* logger;
/*Init logger*/ /*Init logger*/
if (!args.log_args.filename.compare("stdout")) { if (args.log_args.filename == "stdout") {
logger = &logger_stdout; logger = &logger_stdout;
} else { } else {
logger_file.init(args.log_args.filename); logger_file.init(args.log_args.filename);

@ -20,10 +20,7 @@
*/ */
#include "srsepc/hdr/mbms-gw/mbms-gw.h" #include "srsepc/hdr/mbms-gw/mbms-gw.h"
#include "srslte/common/config_file.h" #include "srslte/common/config_file.h"
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <errno.h>
#include <fstream>
#include <iostream> #include <iostream>
#include <signal.h> #include <signal.h>
@ -53,7 +50,7 @@ typedef struct {
srslte::LOG_LEVEL_ENUM level(std::string l) srslte::LOG_LEVEL_ENUM level(std::string l)
{ {
boost::to_upper(l); std::transform(l.begin(), l.end(), l.begin(), ::toupper);
if ("NONE" == l) { if ("NONE" == l) {
return srslte::LOG_LEVEL_NONE; return srslte::LOG_LEVEL_NONE;
} else if ("ERROR" == l) { } else if ("ERROR" == l) {

Loading…
Cancel
Save