Commit bcec69f5 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Add API version to sbi interface

parent 5d8d4adf
......@@ -40,7 +40,7 @@ namespace config {
//------------------------------------------------------------------------------
udr_config::udr_config() : mysql(), instance(), pid_dir(), nudr() {
nudr_http2_port = 8080;
nudr_api_version = "v1";
nudr.api_version = "v1";
}
//------------------------------------------------------------------------------
......@@ -97,12 +97,6 @@ int udr_config::load(const std ::string &config_file) {
Logger::udr_app().error(UDR_CONFIG_STRING_HTTP2_PORT "failed");
throw(UDR_CONFIG_STRING_HTTP2_PORT "failed");
}
// NUDR API VERSION
if (!(nudr_cfg.lookupValue(UDR_CONFIG_STRING_API_VERSION,
nudr_api_version))) {
Logger::udr_app().error(UDR_CONFIG_STRING_API_VERSION "failed");
throw(UDR_CONFIG_STRING_API_VERSION "failed");
}
} catch (const SettingNotFoundException &nfex) {
Logger::udr_app().error("%s : %s, using defaults", nfex.what(),
......@@ -151,7 +145,7 @@ int udr_config::load_interface(const libconfig::Setting &if_cfg,
address.c_str());
return RETURNerror;
}
unsigned char buf_in_addr[sizeof(struct in6_addr)]; // you never know...
unsigned char buf_in_addr[sizeof(struct in6_addr)]; // you never know...
if (inet_pton(AF_INET, util::trim(words.at(0)).c_str(), buf_in_addr) ==
1) {
memcpy(&cfg.addr4, buf_in_addr, sizeof(struct in_addr));
......@@ -167,6 +161,12 @@ int udr_config::load_interface(const libconfig::Setting &if_cfg,
0xFFFFFFFF << (32 - std::stoi(util::trim(words.at(1)))));
}
if_cfg.lookupValue(UDR_CONFIG_STRING_PORT, cfg.port);
// API VERSION
if (!(if_cfg.lookupValue(UDR_CONFIG_STRING_API_VERSION, cfg.api_version))) {
Logger::udr_app().error(UDR_CONFIG_STRING_API_VERSION "failed");
throw(UDR_CONFIG_STRING_API_VERSION "failed");
}
}
return RETURNok;
}
......@@ -190,7 +190,7 @@ void udr_config::display() {
Logger::config().info(" Port ................: %d", nudr.port);
Logger::config().info(" HTTP2 port ..........: %d", nudr_http2_port);
Logger::config().info(" API version..........: %s",
nudr_api_version.c_str());
nudr.api_version.c_str());
Logger::config().info(
"- MYSQL Server Addr...................................: %s",
......@@ -206,4 +206,4 @@ void udr_config::display() {
mysql.mysql_db.c_str());
}
} // namespace config
} // namespace config
......@@ -23,8 +23,8 @@
#define _UDR_CONFIG_H_
#include <arpa/inet.h>
#include <libconfig.h++>
#include <netinet/in.h>
#include <libconfig.h++>
#include <string>
#define UDR_CONFIG_STRING_UDR_CONFIG "UDR"
......@@ -62,11 +62,12 @@ typedef struct interface_cfg_s {
struct in6_addr addr6;
unsigned int mtu;
unsigned int port;
std::string api_version;
} interface_cfg_t;
class udr_config {
public:
public:
udr_config();
~udr_config();
......@@ -78,10 +79,9 @@ public:
std::string pid_dir;
interface_cfg_t nudr;
unsigned int nudr_http2_port;
std::string nudr_api_version;
mysql_conf_t mysql;
};
} // namespace config
} // namespace config
#endif
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