Small modification to parse config file.

master
Pedro Alvarez 7 years ago
parent d0c0d29f62
commit 46edf6feab

@ -0,0 +1,25 @@
#####################################################################
# srsEPC configuration file
#####################################################################
#####################################################################
# MME configuration
#
# mme_code: 8-bit MME code identifies the MME within a group.
# mme_group: 16-bit MME group identifier.
# tac: 16-bit Tracking Area Code.
# mcc: Mobile Country Code
# mnc: Mobile Network Code
# mme_bindx_addr: IP subnet to listen for eNB S1 connnections
#
#####################################################################
[mme]
mme_code = 0x19
mme_group = 0x0001
tac = 0x0001
mcc = 001
mnc = 01
mme_bind_addr = 127.0.0.0/24

@ -22,6 +22,7 @@
* *
*/ */
#include <iostream> #include <iostream>
#include <fstream>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
@ -113,6 +114,25 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
cout << common << endl << general << endl; cout << common << endl << general << endl;
exit(0); exit(0);
} }
//Parsing Config File
if (!vm.count("config_file")) {
cout << "Error: Configuration file not provided" << endl;
cout << "Usage: " << argv[0] << " [OPTIONS] config_file" << endl << endl;
exit(0);
} else {
cout << "Reading configuration file " << config_file << "..." << endl;
ifstream conf(config_file.c_str(), ios::in);
if(conf.fail()) {
cout << "Failed to read configuration file " << config_file << " - exiting" << endl;
exit(1);
}
bpo::store(bpo::parse_config_file(conf, common), vm);
bpo::notify(vm);
}
//Concert hex strings //Concert hex strings
{ {
std::stringstream sstr; std::stringstream sstr;

@ -81,8 +81,8 @@ mme::init(mme_args_t* args, srslte::log_filter *s1ap_log)
/*Init logger*/ /*Init logger*/
m_s1ap_log = s1ap_log; m_s1ap_log = s1ap_log;
m_s1ap_log->info("MME Initialized\n"); m_s1ap_log->info("MME Initialized. MCC: %d, MNC: %d\n",args->s1ap_args.mcc, args->s1ap_args.mnc);
m_s1ap_log->console("MME Initialized\n"); m_s1ap_log->console("MME Initialized. \n");
return 0; return 0;
} }

Loading…
Cancel
Save