Commit 98cd972b authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Initialize variables

parent f79840f3
...@@ -130,14 +130,15 @@ void ausf_app::handle_ue_authentications( ...@@ -130,14 +130,15 @@ void ausf_app::handle_ue_authentications(
// 5g he av from udm // 5g he av from udm
// get authentication related info // get authentication related info
std::string udmUri, method, response; std::string udm_uri = {};
udmUri = "http://" + std::string method = "POST";
std::string response = {};
udm_uri = "http://" +
std::string( std::string(
inet_ntoa(*((struct in_addr*) &ausf_cfg.udm_addr.ipv4_addr))) + inet_ntoa(*((struct in_addr*) &ausf_cfg.udm_addr.ipv4_addr))) +
":" + std::to_string(ausf_cfg.udm_addr.port) + "/nudm-ueau/v1/" + ":" + std::to_string(ausf_cfg.udm_addr.port) + "/nudm-ueau/v1/" +
supi + "/security-information/generate-auth-data"; supi + "/security-information/generate-auth-data";
Logger::ausf_app().debug("UDM's URI %s", udmUri.c_str()); Logger::ausf_app().debug("UDM's URI %s", udm_uri.c_str());
method = "POST";
// Create AuthInfo to send to UDM // Create AuthInfo to send to UDM
nlohmann::json AuthInfo = nlohmann::json AuthInfo =
...@@ -163,7 +164,8 @@ void ausf_app::handle_ue_authentications( ...@@ -163,7 +164,8 @@ void ausf_app::handle_ue_authentications(
} }
// Send request to UDM // Send request to UDM
ausf_client_inst->curl_http_client(udmUri, method, AuthInfo.dump(), response); ausf_client_inst->curl_http_client(
udm_uri, method, AuthInfo.dump(), response);
Logger::ausf_app().info("Response from UDM: %s", response.c_str()); Logger::ausf_app().info("Response from UDM: %s", response.c_str());
...@@ -171,8 +173,12 @@ void ausf_app::handle_ue_authentications( ...@@ -171,8 +173,12 @@ void ausf_app::handle_ue_authentications(
nlohmann::json problemDetails_json = {}; nlohmann::json problemDetails_json = {};
nlohmann::json response_data = {}; nlohmann::json response_data = {};
std::string authType_udm, autn_udm, avType_udm, kausf_udm, rand_udm, std::string authType_udm = {};
xresStar_udm; std::string autn_udm = {};
std::string avType_udm = {};
std::string kausf_udm = {};
std::string rand_udm = {};
std::string xresStar_udm = {};
try { try {
response_data = nlohmann::json::parse(response.c_str()); response_data = nlohmann::json::parse(response.c_str());
// Get security context // Get security context
...@@ -424,15 +430,16 @@ void ausf_app::handle_ue_authentications_confirmation( ...@@ -424,15 +430,16 @@ void ausf_app::handle_ue_authentications_confirmation(
confirmResponse.setSupi(sc->supi_ausf); confirmResponse.setSupi(sc->supi_ausf);
} }
// Send authResult to UDM (authentication result info) // Send authResult to UDM (authentication result info)
std::string udmUri, method, response; std::string udm_uri = {};
udmUri = "http://" + std::string method = "POST";
std::string response = {};
udm_uri = "http://" +
std::string(inet_ntoa( std::string(inet_ntoa(
*((struct in_addr*) &ausf_cfg.udm_addr.ipv4_addr))) + *((struct in_addr*) &ausf_cfg.udm_addr.ipv4_addr))) +
":" + std::to_string(ausf_cfg.udm_addr.port) + "/nudm-ueau/v1/" + ":" + std::to_string(ausf_cfg.udm_addr.port) +
sc->supi_ausf + "/auth-events"; "/nudm-ueau/v1/" + sc->supi_ausf + "/auth-events";
Logger::ausf_app().debug("UDM's URI: %s", udmUri.c_str()); Logger::ausf_app().debug("UDM's URI: %s", udm_uri.c_str());
method = "POST";
// Form request body // Form request body
nlohmann::json confirmResultInfo = {}; nlohmann::json confirmResultInfo = {};
...@@ -456,7 +463,7 @@ void ausf_app::handle_ue_authentications_confirmation( ...@@ -456,7 +463,7 @@ void ausf_app::handle_ue_authentications_confirmation(
Logger::ausf_app().debug( Logger::ausf_app().debug(
"confirmResultInfo: %s", confirmResultInfo.dump().c_str()); "confirmResultInfo: %s", confirmResultInfo.dump().c_str());
ausf_client_inst->curl_http_client( ausf_client_inst->curl_http_client(
udmUri, method, confirmResultInfo.dump(), response); udm_uri, method, confirmResultInfo.dump(), response);
} }
} }
......
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