// // void smf_sbi::register_nf_instance(
// //     std::shared_ptr<itti_n11_register_nf_instance_request> msg) {
// //   Logger::smf_sbi().debug(
// //       "Send NF Instance Registration to NRF (HTTP version %d)",
// //       msg->http_version);
// //   nlohmann::json json_data = {};
// //   msg->profile.to_json(json_data);

// //   std::string url =
// //       std::string(inet_ntoa(*((struct in_addr*) &smf_cfg.nrf_addr.ipv4_addr))) +
// //       ":" + std::to_string(smf_cfg.nrf_addr.port) + NNRF_NFM_BASE +
// //       smf_cfg.nrf_addr.api_version + NNRF_NF_REGISTER_URL +
// //       msg->profile.get_nf_instance_id();

// //   Logger::smf_sbi().debug(
// //       "Send NF Instance Registration to NRF, NRF URL %s", url.c_str());

// //   std::string body = json_data.dump();
// //   Logger::smf_sbi().debug(
// //       "Send NF Instance Registration to NRF, msg body: \n %s", body.c_str());

// //   curl_global_init(CURL_GLOBAL_ALL);
// //   CURL* curl = curl = curl_easy_init();

// //   if (curl) {
// //     CURLcode res               = {};
// //     struct curl_slist* headers = nullptr;
// //     // headers = curl_slist_append(headers, "charsets: utf-8");
// //     headers = curl_slist_append(headers, "content-type: application/json");
// //     curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
// //     curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
// //     curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
// //     curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
// //     curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);

// //     if (msg->http_version == 2) {
// //       curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
// //       // we use a self-signed test server, skip verification during debugging
// //       curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
// //       curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
// //       curl_easy_setopt(
// //           curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
// //     }

// //     // Response information.
// //     long httpCode = {0};
// //     std::unique_ptr<std::string> httpData(new std::string());
// //     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
// //     curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
// //     curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
// //     curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
// //     res = curl_easy_perform(curl);
// //     curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);

// //     Logger::smf_sbi().debug(
// //         "NF Instance Registration, response from NRF, HTTP Code: %d", httpCode);

// //     if (static_cast<http_response_codes_e>(httpCode) ==
// //         http_response_codes_e::HTTP_RESPONSE_CODE_CREATED) {
// //       json response_data = {};
// //       try {
// //         response_data = json::parse(*httpData.get());
// //       } catch (json::exception& e) {
// //         Logger::smf_sbi().warn(
// //             "NF Instance Registration, could not parse json from the NRF "
// //             "response");
// //       }
// //       Logger::smf_sbi().debug(
// //           "NF Instance Registration, response from NRF, json data: \n %s",
// //           response_data.dump().c_str());

// //       // send response to APP to process
// //       std::shared_ptr<itti_n11_register_nf_instance_response> itti_msg =
// //           std::make_shared<itti_n11_register_nf_instance_response>(
// //               TASK_SMF_SBI, TASK_SMF_APP);
// //       itti_msg->http_response_code = httpCode;
// //       itti_msg->http_version       = msg->http_version;
// //       Logger::smf_app().debug("Registered SMF profile (from NRF)");
// //       itti_msg->profile.from_json(response_data);

// //       int ret = itti_inst->send_msg(itti_msg);
// //       if (RETURNok != ret) {
// //         Logger::smf_sbi().error(
// //             "Could not send ITTI message %s to task TASK_SMF_APP",
// //             itti_msg->get_msg_name());
// //       }
// //     } else {
// //       Logger::smf_sbi().warn(
// //           "NF Instance Registration, could not get response from NRF");
// //     }

// //     curl_slist_free_all(headers);
// //     curl_easy_cleanup(curl);
// //   }
// //   curl_global_cleanup();
// // }

// void smf_sbi::subscribe_upf_status_notify(
//     std::shared_ptr<itti_n11_subscribe_upf_status_notify> msg) {
//   Logger::smf_sbi().debug(
//       "Send NFSubscribeNotify to NRF to be notified when a new UPF becomes "
//       "available (HTTP version %d)",
//       msg->http_version);

//   Logger::smf_sbi().debug(
//       "Send NFStatusNotify to NRF, NRF URL %s", msg->url.c_str());

//   std::string body = msg->json_data.dump();
//   Logger::smf_sbi().debug(
//       "Send NFStatusNotify to NRF, msg body: %s", body.c_str());

//   curl_global_init(CURL_GLOBAL_ALL);
//   CURL* curl = curl = curl_easy_init();

//   if (curl) {
//     CURLcode res               = {};
//     struct curl_slist* headers = nullptr;
//     // headers = curl_slist_append(headers, "charsets: utf-8");
//     headers = curl_slist_append(headers, "content-type: application/json");
//     curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
//     curl_easy_setopt(curl, CURLOPT_URL, msg->url.c_str());
//     curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
//     curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);

//     if (msg->http_version == 2) {
//       curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
//       // we use a self-signed test server, skip verification during debugging
//       curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
//       curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
//       curl_easy_setopt(
//           curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
//     }

//     // Response information.
//     long httpCode = {0};
//     std::unique_ptr<std::string> httpData(new std::string());
//     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
//     curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
//     curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
//     curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());

//     res = curl_easy_perform(curl);
//     curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);

//     Logger::smf_sbi().debug(
//         "NFSubscribeNotify, response from NRF, HTTP Code: %d", httpCode);

//     if ((static_cast<http_response_codes_e>(httpCode) ==
//          http_response_codes_e::HTTP_RESPONSE_CODE_CREATED) or
//         (static_cast<http_response_codes_e>(httpCode) ==
//          http_response_codes_e::HTTP_RESPONSE_CODE_NO_CONTENT)) {
//       Logger::smf_sbi().debug(
//           "NFSubscribeNotify, got successful response from NRF");

//     } else {
//       Logger::smf_sbi().warn(
//           "NFSubscribeNotify, could not get response from NRF");
//     }

//     curl_slist_free_all(headers);
//     curl_easy_cleanup(curl);
//   }
//   curl_global_cleanup();
// }


