Commit 58be070c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

apply google style format

parent 53cbf6ec
......@@ -48,7 +48,6 @@ smf_config smf_cfg;
SMFApiServer *smf_api_server_1 = nullptr;
smf_http2_server *smf_api_server_2 = nullptr;
void send_heartbeat_to_tasks(const uint32_t sequence);
//------------------------------------------------------------------------------
......
......@@ -55,7 +55,6 @@ bool Options::validateOptions(){
(options & libconfigcfg)
);
}
bool Options::parseInputOptions( int argc, char **argv )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -28,9 +28,9 @@
*/
#include "smf_event.hpp"
#include "smf_subscription.hpp"
#include "smf_app.hpp"
#include "itti.hpp"
#include "smf_app.hpp"
#include "smf_subscription.hpp"
using namespace smf;
extern smf::smf_app *smf_app_inst;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -38,15 +38,12 @@ namespace bs2 = boost::signals2;
namespace smf {
class smf_event {
public:
smf_event() {
}
;
smf_event(smf_event const&) = delete;
void operator=(smf_event const&) = delete;
smf_event(){};
smf_event(smf_event const &) = delete;
void operator=(smf_event const &) = delete;
static smf_event& get_instance() {
static smf_event &get_instance() {
static smf_event instance;
return instance;
}
......@@ -57,23 +54,29 @@ class smf_event {
/*
* Subscribe to SM Context Status Notification signal
* @param [const sm_context_status_sig_t::slot_type&] sig: slot_type parameter
* @return boost::signals2::connection: the connection between the signal and the slot
* @param [const sm_context_status_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_sm_context_status(
const sm_context_status_sig_t::slot_type &sig);
/*
* Subscribe to Event Exposure Event: PDU Session Release
* @param [const ee_pdu_session_release_sig_t::slot_type&] sig: slot_type parameter
* @return boost::signals2::connection: the connection between the signal and the slot
* @param [const ee_pdu_session_release_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_ee_pdu_session_release(
const ee_pdu_session_release_sig_t::slot_type &sig);
private:
sm_context_status_sig_t sm_context_status; //Signal for SM Context status update
ee_pdu_session_release_sig_t ee_pdu_session_release; //Signal for SM Context status update
sm_context_status_sig_t
sm_context_status; // Signal for SM Context status update
ee_pdu_session_release_sig_t
ee_pdu_session_release; // Signal for SM Context status update
};
}
} // namespace smf
#endif /* FILE_SMF_EVENT_HPP_SEEN */
......@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the
*License at
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -38,15 +38,14 @@ namespace smf {
// Signal for PDU session status
// SCID, PDU Session Status, HTTP version
typedef bs2::signal_type<
void(scid_t, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type sm_context_status_sig_t;
typedef bs2::signal_type<void(scid_t, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
sm_context_status_sig_t;
// Signal for Event exposure
// PDU session Release, SUPI, PDU SessionID, HTTP version
typedef bs2::signal_type<
void(supi64_t, pdu_session_id_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
typedef bs2::signal_type<void(supi64_t, pdu_session_id_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_pdu_session_release_sig_t;
// ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -33,10 +33,10 @@
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include "smf.h"
#include "common_defs.h"
#include "itti.hpp"
#include "logger.hpp"
#include "smf.h"
#include "smf_config.hpp"
using namespace smf;
......@@ -46,7 +46,7 @@ using json = nlohmann::json;
extern itti_mw *itti_inst;
extern smf_n10 *smf_n10_inst;
extern smf_config smf_cfg;
void smf_n10_task(void*);
void smf_n10_task(void *);
/*
* To read content of the response from UDM
......@@ -67,16 +67,16 @@ void smf_n10_task(void *args_p) {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto *msg = shared_msg.get();
switch (msg->msg_type) {
case N10_SESSION_GET_SESSION_MANAGEMENT_SUBSCRIPTION:
//if (itti_n10_get_session_management_subscription* m = dynamic_cast<itti_n10_get_session_management_subscription*>(msg)) {
// if (itti_n10_get_session_management_subscription* m =
// dynamic_cast<itti_n10_get_session_management_subscription*>(msg)) {
// smf_n10_inst->send_sm_data_get_msg(ref(*m));
//}
break;
case TERMINATE:
if (itti_msg_terminate *terminate =
dynamic_cast<itti_msg_terminate*>(msg)) {
dynamic_cast<itti_msg_terminate *>(msg)) {
Logger::smf_n10().info("Received terminate message");
return;
}
......@@ -103,10 +103,11 @@ smf_n10::smf_n10() {
bool smf_n10::get_sm_data(
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription) {
//retrieve a UE's Session Management Subscription Data (TS29503_Nudm_SDM.yaml: /{supi}/sm-data)
//use curl to send data for the moment
// retrieve a UE's Session Management Subscription Data
// (TS29503_Nudm_SDM.yaml: /{supi}/sm-data) use curl to send data for the
// moment
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");
......@@ -114,15 +115,15 @@ bool smf_n10::get_sm_data(
headers = curl_slist_append(headers, "charsets: utf-8");
CURL *curl = curl_easy_init();
std::string url = std::string(
inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) + ":"
+ std::to_string(smf_cfg.udm_addr.port)
+ NUDM_SDM_BASE + smf_cfg.udm_addr.api_version
+ fmt::format(NUDM_SDM_GET_SM_DATA_URL, std::to_string(supi));
std::string url =
std::string(inet_ntoa(*((struct in_addr *)&smf_cfg.udm_addr.ipv4_addr))) +
":" + std::to_string(smf_cfg.udm_addr.port) + NUDM_SDM_BASE +
smf_cfg.udm_addr.api_version +
fmt::format(NUDM_SDM_GET_SM_DATA_URL, std::to_string(supi));
Logger::smf_n10().debug("UDM's URL: %s ", url.c_str());
if (curl) {
CURLcode res = { };
CURLcode res = {};
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
......@@ -131,26 +132,26 @@ bool smf_n10::get_sm_data(
curl_easy_setopt(curl, CURLOPT_INTERFACE, smf_cfg.sbi.if_name.c_str());
// Response information.
long httpCode = { 0 };
long httpCode = {0};
std::unique_ptr<std::string> httpData(new std::string());
// Hook up data handling function.
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
//curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData);
// curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData);
int numRetries = 0;
while (numRetries < UDM_NUMBER_RETRIES) {
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n10().debug("Response from UDM, HTTP Code: %d ", httpCode);
if (static_cast<http_response_codes_e>(httpCode)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK) {
if (static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_OK) {
Logger::smf_n10().debug("Got successful response from UDM, URL: %s ",
url.c_str());
try {
jsonData = nlohmann::json::parse(*httpData.get());
//curl_easy_cleanup(curl);
// curl_easy_cleanup(curl);
break;
} catch (json::exception &e) {
Logger::smf_n10().warn("Could not parse json data from UDM");
......@@ -159,25 +160,25 @@ bool smf_n10::get_sm_data(
} else {
Logger::smf_n10().warn(
"Could not get response from UDM, URL %s, retry ...", url.c_str());
//retry
// retry
numRetries++;
}
}
curl_easy_cleanup(curl);
}
//process the response
// process the response
if (!jsonData.empty()) {
Logger::smf_n10().debug("Response from UDM %s", jsonData.dump().c_str());
//retrieve SessionManagementSubscription and store in the context
// retrieve SessionManagementSubscription and store in the context
for (nlohmann::json::iterator it = jsonData["dnnConfigurations"].begin();
it != jsonData["dnnConfigurations"].end(); ++it) {
it != jsonData["dnnConfigurations"].end(); ++it) {
Logger::smf_n10().debug("DNN %s", it.key().c_str());
try {
std::shared_ptr<dnn_configuration_t> dnn_configuration =
std::make_shared<dnn_configuration_t>();
//PDU Session Type
// PDU Session Type
pdu_session_type_t pdu_session_type(
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4);
std::string default_session_type =
......@@ -197,23 +198,23 @@ bool smf_n10::get_sm_data(
dnn_configuration->pdu_session_types.default_session_type =
pdu_session_type;
//Ssc_Mode
// Ssc_Mode
ssc_mode_t ssc_mode(ssc_mode_e::SSC_MODE_1);
std::string default_ssc_mode = it.value()["sscModes"]["defaultSscMode"];
Logger::smf_n10().debug("Default SSC Mode %s",
default_ssc_mode.c_str());
if (default_ssc_mode.compare("SSC_MODE_1") == 0) {
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(
ssc_mode_e::SSC_MODE_1);
dnn_configuration->ssc_modes.default_ssc_mode =
ssc_mode_t(ssc_mode_e::SSC_MODE_1);
} else if (default_ssc_mode.compare("SSC_MODE_2") == 0) {
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(
ssc_mode_e::SSC_MODE_2);
dnn_configuration->ssc_modes.default_ssc_mode =
ssc_mode_t(ssc_mode_e::SSC_MODE_2);
} else if (default_ssc_mode.compare("SSC_MODE_3") == 0) {
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(
ssc_mode_e::SSC_MODE_3);
dnn_configuration->ssc_modes.default_ssc_mode =
ssc_mode_t(ssc_mode_e::SSC_MODE_3);
}
//5gQosProfile
// 5gQosProfile
dnn_configuration->_5g_qos_profile._5qi =
it.value()["5gQosProfile"]["5qi"];
dnn_configuration->_5g_qos_profile.arp.priority_level =
......@@ -222,9 +223,10 @@ bool smf_n10::get_sm_data(
it.value()["5gQosProfile"]["arp"]["preemptCap"];
dnn_configuration->_5g_qos_profile.arp.preempt_vuln =
it.value()["5gQosProfile"]["arp"]["preemptVuln"];
dnn_configuration->_5g_qos_profile.priority_level = 1; //TODO: hardcoded
dnn_configuration->_5g_qos_profile.priority_level =
1; // TODO: hardcoded
//session_ambr
// session_ambr
dnn_configuration->session_ambr.uplink =
it.value()["sessionAmbr"]["uplink"];
dnn_configuration->session_ambr.downlink =
......@@ -245,11 +247,9 @@ bool smf_n10::get_sm_data(
} else {
return false;
}
}
//------------------------------------------------------------------------------
void smf_n10::subscribe_sm_data() {
//TODO:
// TODO:
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,11 +29,11 @@
#ifndef FILE_SMF_N10_HPP_SEEN
#define FILE_SMF_N10_HPP_SEEN
#include <thread>
#include <map>
#include <thread>
#include "smf.h"
#include "3gpp_29.503.h"
#include "smf.h"
#include "smf_context.hpp"
namespace smf {
......@@ -45,8 +45,8 @@ class smf_n10 {
public:
smf_n10();
smf_n10(smf_n10 const&) = delete;
void operator=(smf_n10 const&) = delete;
smf_n10(smf_n10 const &) = delete;
void operator=(smf_n10 const &) = delete;
/*
* Get SM subscription data from UDM
......@@ -68,8 +68,7 @@ class smf_n10 {
*
*/
void subscribe_sm_data();
};
}
} // namespace smf
#endif /* FILE_SMF_N10_HPP_SEEN */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -40,13 +40,13 @@
*/
typedef struct protocol_configuration_options_ids_s {
// Protocol identifiers (from configuration protocol options list)
uint8_t pi_ipcp :1;
uint8_t pi_ipcp : 1;
// Container identifiers (from additional parameters list)
uint8_t ci_dns_server_ipv4_address_request :1;
uint8_t ci_ip_address_allocation_via_nas_signalling :1;
uint8_t ci_ipv4_address_allocation_via_dhcpv4 :1;
uint8_t ci_ipv4_link_mtu_request :1;
uint8_t ci_dns_server_ipv4_address_request : 1;
uint8_t ci_ip_address_allocation_via_nas_signalling : 1;
uint8_t ci_ipv4_address_allocation_via_dhcpv4 : 1;
uint8_t ci_ipv4_link_mtu_request : 1;
} protocol_configuration_options_ids_t;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -28,8 +28,8 @@
*/
#include "smf_subscription.hpp"
#include "smf_app.hpp"
#include "itti.hpp"
#include "smf_app.hpp"
#include "common_defs.h"
#include "itti_msg_sbi.hpp"
......@@ -38,5 +38,3 @@ using namespace smf;
extern smf::smf_app *smf_app_inst;
extern itti_mw *itti_inst;
This diff is collapsed.
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