Commit 2716d4c0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add function header

parent 2816b551
...@@ -777,16 +777,7 @@ void smf_sbi::subscribe_upf_status_notify( ...@@ -777,16 +777,7 @@ void smf_sbi::subscribe_upf_status_notify(
bool smf_sbi::get_sm_data( bool smf_sbi::get_sm_data(
const supi64_t& supi, const std::string& dnn, const snssai_t& snssai, const supi64_t& supi, const std::string& dnn, const snssai_t& snssai,
std::shared_ptr<session_management_subscription> subscription) { std::shared_ptr<session_management_subscription> subscription) {
// retrieve a UE's Session Management Subscription Data
nlohmann::json jsonData = {}; nlohmann::json jsonData = {};
curl_global_init(CURL_GLOBAL_DEFAULT);
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8");
CURL* curl = curl_easy_init();
std::string url = std::string url =
std::string(inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) + std::string(inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) +
":" + std::to_string(smf_cfg.udm_addr.port) + NUDM_SDM_BASE + ":" + std::to_string(smf_cfg.udm_addr.port) + NUDM_SDM_BASE +
......
...@@ -170,21 +170,42 @@ class smf_sbi { ...@@ -170,21 +170,42 @@ class smf_sbi {
/* /*
* Create Curl handle for multi curl * Create Curl handle for multi curl
* @param [const std::string &] uri: URI of the subscribed NF * @param [const std::string &] uri: URI of the subscribed NF
* @param [std::string &] data: data to be sent * @param [const char* ] data: pointer to the data to be sent
* @param [uint32_t] data_len: len of data to be sent
* @param [std::string &] response_data: response data * @param [std::string &] response_data: response data
* @return pointer to the created curl * @param [uint32_t* ] promise_id: pointer to the promise id
* @param [const std::string&] method: HTTP method
* @param [bool] is_multipart: use multipart or json format
* @return void
*/ */
void curl_create_handle( void curl_create_handle(
const std::string& uri, const char* data, uint32_t data_len, const std::string& uri, const char* data, uint32_t data_len,
std::string& response_data, uint32_t* promise_id, std::string& response_data, uint32_t* promise_id,
const std::string& method, bool is_multipart); const std::string& method, bool is_multipart);
/*
* Create Curl handle for multi curl
* @param [const std::string &] uri: URI of the subscribed NF
* @param [const std::string& ] data: data to be sent
* @param [std::string &] response_data: response data
* @param [uint32_t* ] promise_id: pointer to the promise id
* @param [const std::string&] method: HTTP method
* @param [bool] is_multipart: use multipart or json format
* @return void
*/
void curl_create_handle( void curl_create_handle(
const std::string& uri, const std::string& data, const std::string& uri, const std::string& data,
std::string& response_data, uint32_t* promise_id, std::string& response_data, uint32_t* promise_id,
const std::string& method); const std::string& method);
/*
* Create Curl handle for multi curl
* @param [const std::string &] uri: URI of the subscribed NF
* @param [std::string &] response_data: response data
* @param [uint32_t* ] promise_id: pointer to the promise id
* @param [const std::string&] method: HTTP method
* @return void
*/
void curl_create_handle( void curl_create_handle(
const std::string& uri, std::string& response_data, uint32_t* promise_id, const std::string& uri, std::string& response_data, uint32_t* promise_id,
const std::string& method); const std::string& method);
...@@ -203,11 +224,35 @@ class smf_sbi { ...@@ -203,11 +224,35 @@ class smf_sbi {
*/ */
void curl_release_handles(); void curl_release_handles();
/*
* Wait for the promise ready
* @param [boost::shared_future<uint32_t>&] f: future
* @return future value
*/
uint32_t get_available_response(boost::shared_future<uint32_t>& f); uint32_t get_available_response(boost::shared_future<uint32_t>& f);
/*
* Store the promise
* @param [uint32_t] pid: promise id
* @param [boost::shared_ptr<boost::promise<uint32_t>>&] p: promise
* @return void
*/
void add_promise( void add_promise(
uint32_t pid, boost::shared_ptr<boost::promise<uint32_t>>& p); uint32_t pid, boost::shared_ptr<boost::promise<uint32_t>>& p);
/*
* Set the value of the promise to make it ready
* @param [uint32_t] pid: promise id
* @param [uint32_t ] http_code: http response code
* @return void
*/
void trigger_process_response(uint32_t pid, uint32_t http_code); void trigger_process_response(uint32_t pid, uint32_t http_code);
/*
* Generate an unique value for promise id
* @param void
* @return generated promise id
*/
static uint64_t generate_promise_id() { static uint64_t generate_promise_id() {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid(); return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
} }
......
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