Commit d0e04933 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Fix supi format w/wo prefix

parent 0c968569
...@@ -60,6 +60,17 @@ static std::string smf_supi_to_string(supi_t const supi) { ...@@ -60,6 +60,17 @@ static std::string smf_supi_to_string(supi_t const supi) {
return supi_str; return supi_str;
} }
static std::string smf_get_supi_with_prefix(
const std::string& prefix, const std::string& supi) {
std::string supi_str = {};
if (!prefix.empty()) {
supi_str = prefix + "-" + supi;
} else {
supi_str = supi;
}
return supi_str;
}
// TODO should we just replace the other function? Because this null chars are // TODO should we just replace the other function? Because this null chars are
// annoying // annoying
static std::string smf_supi_to_string_without_nulls(supi_t const supi) { static std::string smf_supi_to_string_without_nulls(supi_t const supi) {
......
...@@ -184,9 +184,16 @@ void xgpp_conv::sm_context_create_from_openapi( ...@@ -184,9 +184,16 @@ void xgpp_conv::sm_context_create_from_openapi(
if (context_data.supiIsSet()) { if (context_data.supiIsSet()) {
// supi // supi
supi_t supi = {.length = 0}; supi_t supi = {.length = 0};
std::string supi_str = {};
std::string supi_prefix = {};
std::size_t pos = context_data.getSupi().find("-"); std::size_t pos = context_data.getSupi().find("-");
std::string supi_str = context_data.getSupi().substr(pos + 1); if (pos != std::string::npos) {
std::string supi_prefix = context_data.getSupi().substr(0, pos); supi_str = context_data.getSupi().substr(pos + 1);
supi_prefix = context_data.getSupi().substr(0, pos);
} else {
supi_str = context_data.getSupi();
}
smf_string_to_supi(&supi, supi_str.c_str()); smf_string_to_supi(&supi, supi_str.c_str());
pcr.set_supi(supi); pcr.set_supi(supi);
pcr.set_supi_prefix(supi_prefix); pcr.set_supi_prefix(supi_prefix);
......
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