Commit 789c6c85 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

First running version for UDR

parent 8b6feda9
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h" #include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -26,12 +25,10 @@ using namespace oai::udr::model; ...@@ -26,12 +25,10 @@ using namespace oai::udr::model;
AMF3GPPAccessRegistrationDocumentApiImpl:: AMF3GPPAccessRegistrationDocumentApiImpl::
AMF3GPPAccessRegistrationDocumentApiImpl( AMF3GPPAccessRegistrationDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: AMF3GPPAccessRegistrationDocumentApi(rtr), : AMF3GPPAccessRegistrationDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void AMF3GPPAccessRegistrationDocumentApiImpl::amf_context3gpp( void AMF3GPPAccessRegistrationDocumentApiImpl::amf_context3gpp(
const std::string &ueId, const std::vector<PatchItem> &patchItem, const std::string &ueId, const std::vector<PatchItem> &patchItem,
...@@ -50,374 +47,26 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp( ...@@ -50,374 +47,26 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(
const std::string &ueId, const std::string &ueId,
Amf3GppAccessRegistration &amf3GppAccessRegistration, Amf3GppAccessRegistration &amf3GppAccessRegistration,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
m_udr_app->handle_amf_3gpp_access_registration_document_create_amf_context(
const std::string select_AMF3GPPAccessRegistration = ueId, amf3GppAccessRegistration, response_data, code);
"select * from Amf3GppAccessRegistration WHERE ueid='" + ueId + "'";
std::string query;
nlohmann::json j;
if (mysql_real_query(
mysql_WitcommUDRDB, select_AMF3GPPAccessRegistration.c_str(),
(unsigned long)select_AMF3GPPAccessRegistration.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_AMF3GPPAccessRegistration.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
if (res == NULL) { response.send(code, response_data.dump());
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_AMF3GPPAccessRegistration.c_str());
return;
}
if (mysql_num_rows(res)) {
query =
"update Amf3GppAccessRegistration set amfInstanceId='" +
amf3GppAccessRegistration.getAmfInstanceId() + "'" +
(amf3GppAccessRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" +
amf3GppAccessRegistration.getSupportedFeatures() + "'"
: "") +
(amf3GppAccessRegistration.purgeFlagIsSet()
? (amf3GppAccessRegistration.isPurgeFlag() ? ",purgeFlag=1"
: ",purgeFlag=0")
: "") +
(amf3GppAccessRegistration.peiIsSet()
? ",pei='" + amf3GppAccessRegistration.getPei() + "'"
: "") +
",deregCallbackUri='" +
amf3GppAccessRegistration.getDeregCallbackUri() + "'" +
(amf3GppAccessRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
amf3GppAccessRegistration.getPcscfRestorationCallbackUri() +
"'"
: "") +
(amf3GppAccessRegistration.initialRegistrationIndIsSet()
? (amf3GppAccessRegistration.isInitialRegistrationInd()
? ",initialRegistrationInd=1"
: ",initialRegistrationInd=0")
: "") +
(amf3GppAccessRegistration.drFlagIsSet()
? (amf3GppAccessRegistration.isDrFlag() ? ",drFlag=1"
: ",drFlag=0")
: "") +
(amf3GppAccessRegistration.urrpIndicatorIsSet()
? (amf3GppAccessRegistration.isUrrpIndicator()
? ",urrpIndicator=1"
: ",urrpIndicator=0")
: "") +
(amf3GppAccessRegistration.amfEeSubscriptionIdIsSet()
? ",amfEeSubscriptionId='" +
amf3GppAccessRegistration.getAmfEeSubscriptionId() + "'"
: "") +
(amf3GppAccessRegistration.ueSrvccCapabilityIsSet()
? (amf3GppAccessRegistration.isUeSrvccCapability()
? ",ueSrvccCapability=1"
: ",ueSrvccCapability=0")
: "") +
(amf3GppAccessRegistration.registrationTimeIsSet()
? ",registrationTime='" +
amf3GppAccessRegistration.getRegistrationTime() + "'"
: "") +
(amf3GppAccessRegistration.noEeSubscriptionIndIsSet()
? (amf3GppAccessRegistration.isNoEeSubscriptionInd()
? ",noEeSubscriptionInd=1"
: ",noEeSubscriptionInd=0")
: "");
if (amf3GppAccessRegistration.imsVoPsIsSet()) {
to_json(j, amf3GppAccessRegistration.getImsVoPs());
query += ",imsVoPs='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNameDeregIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNameDereg());
query += ",amfServiceNameDereg='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNamePcscfRestIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNamePcscfRest());
query += ",amfServiceNamePcscfRest='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.backupAmfInfoIsSet()) {
nlohmann::json tmp;
j.clear();
std::vector<BackupAmfInfo> backupamfinfo =
amf3GppAccessRegistration.getBackupAmfInfo();
for (int i = 0; i < backupamfinfo.size(); i++) {
to_json(tmp, backupamfinfo[i]);
j += tmp;
}
query += ",backupAmfInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.epsInterworkingInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getEpsInterworkingInfo());
query += ",epsInterworkingInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.vgmlcAddressIsSet()) {
to_json(j, amf3GppAccessRegistration.getVgmlcAddress());
query += ",vgmlcAddress='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.contextInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, amf3GppAccessRegistration.getGuami());
query += ",guami='" + j.dump() + "'";
to_json(j, amf3GppAccessRegistration.getRatType());
query += ",ratType='" + j.dump() + "'";
query += " where ueid='" + ueId + "'";
} else {
query =
"insert into Amf3GppAccessRegistration set ueid='" + ueId + "'" +
",amfInstanceId='" + amf3GppAccessRegistration.getAmfInstanceId() +
"'" +
(amf3GppAccessRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" +
amf3GppAccessRegistration.getSupportedFeatures() + "'"
: "") +
(amf3GppAccessRegistration.purgeFlagIsSet()
? (amf3GppAccessRegistration.isPurgeFlag() ? ",purgeFlag=1"
: ",purgeFlag=0")
: "") +
(amf3GppAccessRegistration.peiIsSet()
? ",pei='" + amf3GppAccessRegistration.getPei() + "'"
: "") +
",deregCallbackUri='" +
amf3GppAccessRegistration.getDeregCallbackUri() + "'" +
(amf3GppAccessRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
amf3GppAccessRegistration.getPcscfRestorationCallbackUri() +
"'"
: "") +
(amf3GppAccessRegistration.initialRegistrationIndIsSet()
? (amf3GppAccessRegistration.isInitialRegistrationInd()
? ",initialRegistrationInd=1"
: ",initialRegistrationInd=0")
: "") +
(amf3GppAccessRegistration.drFlagIsSet()
? (amf3GppAccessRegistration.isDrFlag() ? ",drFlag=1"
: ",drFlag=0")
: "") +
(amf3GppAccessRegistration.urrpIndicatorIsSet()
? (amf3GppAccessRegistration.isUrrpIndicator()
? ",urrpIndicator=1"
: ",urrpIndicator=0")
: "") +
(amf3GppAccessRegistration.amfEeSubscriptionIdIsSet()
? ",amfEeSubscriptionId='" +
amf3GppAccessRegistration.getAmfEeSubscriptionId() + "'"
: "") +
(amf3GppAccessRegistration.ueSrvccCapabilityIsSet()
? (amf3GppAccessRegistration.isUeSrvccCapability()
? ",ueSrvccCapability=1"
: ",ueSrvccCapability=0")
: "") +
(amf3GppAccessRegistration.registrationTimeIsSet()
? ",registrationTime='" +
amf3GppAccessRegistration.getRegistrationTime() + "'"
: "") +
(amf3GppAccessRegistration.noEeSubscriptionIndIsSet()
? (amf3GppAccessRegistration.isNoEeSubscriptionInd()
? ",noEeSubscriptionInd=1"
: ",noEeSubscriptionInd=0")
: "");
if (amf3GppAccessRegistration.imsVoPsIsSet()) {
to_json(j, amf3GppAccessRegistration.getImsVoPs());
query += ",imsVoPs='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNameDeregIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNameDereg());
query += ",amfServiceNameDereg='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNamePcscfRestIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNamePcscfRest());
query += ",amfServiceNamePcscfRest='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.backupAmfInfoIsSet()) {
nlohmann::json tmp;
j.clear();
std::vector<BackupAmfInfo> backupamfinfo =
amf3GppAccessRegistration.getBackupAmfInfo();
for (int i = 0; i < backupamfinfo.size(); i++) {
to_json(tmp, backupamfinfo[i]);
j += tmp;
}
query += ",backupAmfInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.epsInterworkingInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getEpsInterworkingInfo());
query += ",epsInterworkingInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.vgmlcAddressIsSet()) {
to_json(j, amf3GppAccessRegistration.getVgmlcAddress());
query += ",vgmlcAddress='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.contextInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, amf3GppAccessRegistration.getGuami());
query += ",guami='" + j.dump() + "'";
to_json(j, amf3GppAccessRegistration.getRatType());
query += ",ratType='" + j.dump() + "'";
}
mysql_free_result(res);
// std::cout << query << std::endl;
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
to_json(j, amf3GppAccessRegistration);
response.send(Pistache::Http::Code::Created, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("Amf3GppAccessRegistration PUT - json:\n\"%s\"",
out.c_str());
} }
void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp( void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp(
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_amf_3gpp_access_registration_document_query_amf_context(
ueId, response_data, code);
nlohmann::json j;
Amf3GppAccessRegistration amf3gppaccessregistration;
const std::string query =
"select * from Amf3GppAccessRegistration WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("amfInstanceId", field->name)) {
amf3gppaccessregistration.setAmfInstanceId(row[i]);
} else if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
amf3gppaccessregistration.setSupportedFeatures(row[i]);
} else if (!strcmp("purgeFlag", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setPurgeFlag(true);
else
amf3gppaccessregistration.setPurgeFlag(false);
} else if (!strcmp("pei", field->name) && row[i] != NULL) {
amf3gppaccessregistration.setPei(row[i]);
} else if (!strcmp("imsVoPs", field->name) && row[i] != NULL) {
ImsVoPs imsvops;
nlohmann::json::parse(row[i]).get_to(imsvops);
amf3gppaccessregistration.setImsVoPs(imsvops);
} else if (!strcmp("deregCallbackUri", field->name)) {
amf3gppaccessregistration.setDeregCallbackUri(row[i]);
} else if (!strcmp("amfServiceNameDereg", field->name) &&
row[i] != NULL) {
ServiceName amfservicenamedereg;
nlohmann::json::parse(row[i]).get_to(amfservicenamedereg);
amf3gppaccessregistration.setAmfServiceNameDereg(amfservicenamedereg);
} else if (!strcmp("pcscfRestorationCallbackUri", field->name) &&
row[i] != NULL) {
amf3gppaccessregistration.setPcscfRestorationCallbackUri(row[i]);
} else if (!strcmp("amfServiceNamePcscfRest", field->name) &&
row[i] != NULL) {
ServiceName amfservicenamepcscfrest;
nlohmann::json::parse(row[i]).get_to(amfservicenamepcscfrest);
amf3gppaccessregistration.setAmfServiceNamePcscfRest(
amfservicenamepcscfrest);
} else if (!strcmp("initialRegistrationInd", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setInitialRegistrationInd(true);
else
amf3gppaccessregistration.setInitialRegistrationInd(false);
} else if (!strcmp("guami", field->name)) {
Guami guami;
nlohmann::json::parse(row[i]).get_to(guami);
amf3gppaccessregistration.setGuami(guami);
} else if (!strcmp("backupAmfInfo", field->name) && row[i] != NULL) {
std ::vector<BackupAmfInfo> backupamfinfo;
nlohmann::json::parse(row[i]).get_to(backupamfinfo);
amf3gppaccessregistration.setBackupAmfInfo(backupamfinfo);
} else if (!strcmp("drFlag", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setDrFlag(true);
else
amf3gppaccessregistration.setDrFlag(false);
} else if (!strcmp("ratType", field->name)) {
RatType rattype;
nlohmann::json::parse(row[i]).get_to(rattype);
amf3gppaccessregistration.setRatType(rattype);
} else if (!strcmp("urrpIndicator", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setUrrpIndicator(true);
else
amf3gppaccessregistration.setUrrpIndicator(false);
} else if (!strcmp("amfEeSubscriptionId", field->name) &&
row[i] != NULL) {
amf3gppaccessregistration.setAmfEeSubscriptionId(row[i]);
} else if (!strcmp("epsInterworkingInfo", field->name) &&
row[i] != NULL) {
EpsInterworkingInfo epsinterworkinginfo;
nlohmann::json::parse(row[i]).get_to(epsinterworkinginfo);
amf3gppaccessregistration.setEpsInterworkingInfo(epsinterworkinginfo);
} else if (!strcmp("ueSrvccCapability", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setUeSrvccCapability(true);
else
amf3gppaccessregistration.setUeSrvccCapability(false);
} else if (!strcmp("registrationTime", field->name) && row[i] != NULL) {
amf3gppaccessregistration.setRegistrationTime(row[i]);
} else if (!strcmp("vgmlcAddress", field->name) && row[i] != NULL) {
VgmlcAddress vgmlcaddress;
nlohmann::json::parse(row[i]).get_to(vgmlcaddress);
amf3gppaccessregistration.setVgmlcAddress(vgmlcaddress);
} else if (!strcmp("contextInfo", field->name) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
amf3gppaccessregistration.setContextInfo(contextinfo);
} else if (!strcmp("noEeSubscriptionInd", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setNoEeSubscriptionInd(true);
else
amf3gppaccessregistration.setNoEeSubscriptionInd(false);
}
}
to_json(j, amf3gppaccessregistration);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("Amf3GppAccessRegistration GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("Amf3GppAccessRegistration no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,24 +20,20 @@ ...@@ -20,24 +20,20 @@
#ifndef AMF3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_ #ifndef AMF3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_
#define AMF3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_ #define AMF3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <AMF3GPPAccessRegistrationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AMF3GPPAccessRegistrationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "Amf3GppAccessRegistration.h" #include "Amf3GppAccessRegistration.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include <mysql/mysql.h>
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -53,7 +49,7 @@ class AMF3GPPAccessRegistrationDocumentApiImpl ...@@ -53,7 +49,7 @@ class AMF3GPPAccessRegistrationDocumentApiImpl
public: public:
AMF3GPPAccessRegistrationDocumentApiImpl( AMF3GPPAccessRegistrationDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql); std::string address);
~AMF3GPPAccessRegistrationDocumentApiImpl() {} ~AMF3GPPAccessRegistrationDocumentApiImpl() {}
void amf_context3gpp(const std::string &ueId, void amf_context3gpp(const std::string &ueId,
...@@ -69,9 +65,6 @@ class AMF3GPPAccessRegistrationDocumentApiImpl ...@@ -69,9 +65,6 @@ class AMF3GPPAccessRegistrationDocumentApiImpl
const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -20,23 +20,21 @@ ...@@ -20,23 +20,21 @@
#ifndef AMF_NON3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_ #ifndef AMF_NON3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_
#define AMF_NON3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_ #define AMF_NON3_GPP_ACCESS_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <AMFNon3GPPAccessRegistrationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AMFNon3GPPAccessRegistrationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "Amf3GppAccessRegistration.h" #include "Amf3GppAccessRegistration.h"
#include "AmfNon3GppAccessRegistration.h" #include "AmfNon3GppAccessRegistration.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef ACCESS_AND_MOBILITY_DATA_API_IMPL_H_ #ifndef ACCESS_AND_MOBILITY_DATA_API_IMPL_H_
#define ACCESS_AND_MOBILITY_DATA_API_IMPL_H_ #define ACCESS_AND_MOBILITY_DATA_API_IMPL_H_
#include <AccessAndMobilityDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessAndMobilityDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AccessAndMobilityData.h" #include "AccessAndMobilityData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef ACCESS_AND_MOBILITY_POLICY_DATA_DOCUMENT_API_IMPL_H_ #ifndef ACCESS_AND_MOBILITY_POLICY_DATA_DOCUMENT_API_IMPL_H_
#define ACCESS_AND_MOBILITY_POLICY_DATA_DOCUMENT_API_IMPL_H_ #define ACCESS_AND_MOBILITY_POLICY_DATA_DOCUMENT_API_IMPL_H_
#include <AccessAndMobilityPolicyDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessAndMobilityPolicyDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AmPolicyData.h" #include "AmPolicyData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h" #include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "logger.hpp" #include "logger.hpp"
...@@ -26,12 +27,10 @@ using namespace oai::udr::model; ...@@ -26,12 +27,10 @@ using namespace oai::udr::model;
AccessAndMobilitySubscriptionDataDocumentApiImpl:: AccessAndMobilitySubscriptionDataDocumentApiImpl::
AccessAndMobilitySubscriptionDataDocumentApiImpl( AccessAndMobilitySubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: AccessAndMobilitySubscriptionDataDocumentApi(rtr), : AccessAndMobilitySubscriptionDataDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data( void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(
const std::string &ueId, const std::string &servingPlmnId, const std::string &ueId, const std::string &servingPlmnId,
...@@ -47,269 +46,6 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data( ...@@ -47,269 +46,6 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(
Logger::udr_server().debug("HTTP reponse code %d.\n", code); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump()); response.send(code, response_data.dump());
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
AccessAndMobilitySubscriptionData accessandmobilitysubscriptiondata;
const std::string query =
"select * from AccessAndMobilitySubscriptionData WHERE ueid='" + ueId +
"' and servingPlmnid='" + servingPlmnId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!");
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!");
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
accessandmobilitysubscriptiondata.setSupportedFeatures(row[i]);
} else if (!strcmp("gpsis", field->name) && row[i] != NULL) {
std::vector<std ::string> gpsis;
nlohmann::json::parse(row[i]).get_to(gpsis);
accessandmobilitysubscriptiondata.setGpsis(gpsis);
} else if (!strcmp("internalGroupIds", field->name) && row[i] != NULL) {
std::vector<std ::string> internalgroupids;
nlohmann::json::parse(row[i]).get_to(internalgroupids);
accessandmobilitysubscriptiondata.setInternalGroupIds(internalgroupids);
} else if (!strcmp("sharedVnGroupDataIds", field->name) &&
row[i] != NULL) {
std::map<std ::string, std::string> sharedvngroupdataids;
nlohmann::json::parse(row[i]).get_to(sharedvngroupdataids);
accessandmobilitysubscriptiondata.setSharedVnGroupDataIds(
sharedvngroupdataids);
} else if (!strcmp("subscribedUeAmbr", field->name) && row[i] != NULL) {
AmbrRm subscribedueambr;
nlohmann::json::parse(row[i]).get_to(subscribedueambr);
accessandmobilitysubscriptiondata.setSubscribedUeAmbr(subscribedueambr);
} else if (!strcmp("nssai", field->name) && row[i] != NULL) {
Nssai nssai;
nlohmann::json::parse(row[i]).get_to(nssai);
accessandmobilitysubscriptiondata.setNssai(nssai);
} else if (!strcmp("ratRestrictions", field->name) && row[i] != NULL) {
std ::vector<RatType> ratrestrictions;
nlohmann::json::parse(row[i]).get_to(ratrestrictions);
accessandmobilitysubscriptiondata.setRatRestrictions(ratrestrictions);
} else if (!strcmp("forbiddenAreas", field->name) && row[i] != NULL) {
std ::vector<Area> forbiddenareas;
nlohmann::json::parse(row[i]).get_to(forbiddenareas);
accessandmobilitysubscriptiondata.setForbiddenAreas(forbiddenareas);
} else if (!strcmp("serviceAreaRestriction", field->name) &&
row[i] != NULL) {
ServiceAreaRestriction servicearearestriction;
nlohmann::json::parse(row[i]).get_to(servicearearestriction);
accessandmobilitysubscriptiondata.setServiceAreaRestriction(
servicearearestriction);
} else if (!strcmp("coreNetworkTypeRestrictions", field->name) &&
row[i] != NULL) {
std ::vector<CoreNetworkType> corenetworktyperestrictions;
nlohmann::json::parse(row[i]).get_to(corenetworktyperestrictions);
accessandmobilitysubscriptiondata.setCoreNetworkTypeRestrictions(
corenetworktyperestrictions);
} else if (!strcmp("rfspIndex", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setRfspIndex(a);
} else if (!strcmp("subsRegTimer", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setSubsRegTimer(a);
} else if (!strcmp("ueUsageType", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setUeUsageType(a);
} else if (!strcmp("mpsPriority", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setMpsPriority(true);
else
accessandmobilitysubscriptiondata.setMpsPriority(false);
} else if (!strcmp("mcsPriority", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setMcsPriority(true);
else
accessandmobilitysubscriptiondata.setMcsPriority(false);
} else if (!strcmp("activeTime", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setActiveTime(a);
} else if (!strcmp("sorInfo", field->name) && row[i] != NULL) {
SorInfo sorinfo;
nlohmann::json::parse(row[i]).get_to(sorinfo);
accessandmobilitysubscriptiondata.setSorInfo(sorinfo);
} else if (!strcmp("sorInfoExpectInd", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setSorInfoExpectInd(true);
else
accessandmobilitysubscriptiondata.setSorInfoExpectInd(false);
} else if (!strcmp("sorafRetrieval", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setSorafRetrieval(true);
else
accessandmobilitysubscriptiondata.setSorafRetrieval(false);
} else if (!strcmp("sorUpdateIndicatorList", field->name) &&
row[i] != NULL) {
std ::vector<SorUpdateIndicator> sorupdateindicatorlist;
nlohmann::json::parse(row[i]).get_to(sorupdateindicatorlist);
accessandmobilitysubscriptiondata.setSorUpdateIndicatorList(
sorupdateindicatorlist);
} else if (!strcmp("upuInfo", field->name) && row[i] != NULL) {
UpuInfo upuinfo;
nlohmann::json::parse(row[i]).get_to(upuinfo);
accessandmobilitysubscriptiondata.setUpuInfo(upuinfo);
} else if (!strcmp("micoAllowed", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setMicoAllowed(true);
else
accessandmobilitysubscriptiondata.setMicoAllowed(false);
} else if (!strcmp("sharedAmDataIds", field->name) && row[i] != NULL) {
std ::vector<std ::string> sharedamdataids;
nlohmann::json::parse(row[i]).get_to(sharedamdataids);
accessandmobilitysubscriptiondata.setSharedAmDataIds(sharedamdataids);
} else if (!strcmp("odbPacketServices", field->name) && row[i] != NULL) {
OdbPacketServices odbpacketservices;
nlohmann::json::parse(row[i]).get_to(odbpacketservices);
accessandmobilitysubscriptiondata.setOdbPacketServices(
odbpacketservices);
} else if (!strcmp("serviceGapTime", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setServiceGapTime(a);
} else if (!strcmp("mdtUserConsent", field->name) && row[i] != NULL) {
MdtUserConsent mdtuserconsent;
nlohmann::json::parse(row[i]).get_to(mdtuserconsent);
accessandmobilitysubscriptiondata.setMdtUserConsent(mdtuserconsent);
} else if (!strcmp("mdtConfiguration", field->name) && row[i] != NULL) {
MdtConfiguration mdtconfiguration;
nlohmann::json::parse(row[i]).get_to(mdtconfiguration);
accessandmobilitysubscriptiondata.setMdtConfiguration(mdtconfiguration);
} else if (!strcmp("traceData", field->name) && row[i] != NULL) {
TraceData tracedata;
nlohmann::json::parse(row[i]).get_to(tracedata);
accessandmobilitysubscriptiondata.setTraceData(tracedata);
} else if (!strcmp("cagData", field->name) && row[i] != NULL) {
CagData cagdata;
nlohmann::json::parse(row[i]).get_to(cagdata);
accessandmobilitysubscriptiondata.setCagData(cagdata);
} else if (!strcmp("stnSr", field->name) && row[i] != NULL) {
accessandmobilitysubscriptiondata.setStnSr(row[i]);
} else if (!strcmp("cMsisdn", field->name) && row[i] != NULL) {
accessandmobilitysubscriptiondata.setCMsisdn(row[i]);
} else if (!strcmp("nbIoTUePriority", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setNbIoTUePriority(a);
} else if (!strcmp("nssaiInclusionAllowed", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setNssaiInclusionAllowed(true);
else
accessandmobilitysubscriptiondata.setNssaiInclusionAllowed(false);
} else if (!strcmp("rgWirelineCharacteristics", field->name) &&
row[i] != NULL) {
accessandmobilitysubscriptiondata.setRgWirelineCharacteristics(row[i]);
} else if (!strcmp("ecRestrictionDataWb", field->name) &&
row[i] != NULL) {
EcRestrictionDataWb ecrestrictiondatawb;
nlohmann::json::parse(row[i]).get_to(ecrestrictiondatawb);
accessandmobilitysubscriptiondata.setEcRestrictionDataWb(
ecrestrictiondatawb);
} else if (!strcmp("ecRestrictionDataNb", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setEcRestrictionDataNb(true);
else
accessandmobilitysubscriptiondata.setEcRestrictionDataNb(false);
} else if (!strcmp("expectedUeBehaviourList", field->name) &&
row[i] != NULL) {
ExpectedUeBehaviourData expecteduebehaviourlist;
nlohmann::json::parse(row[i]).get_to(expecteduebehaviourlist);
accessandmobilitysubscriptiondata.setExpectedUeBehaviourList(
expecteduebehaviourlist);
} else if (!strcmp("primaryRatRestrictions", field->name) &&
row[i] != NULL) {
std ::vector<RatType> primaryratrestrictions;
nlohmann::json::parse(row[i]).get_to(primaryratrestrictions);
accessandmobilitysubscriptiondata.setPrimaryRatRestrictions(
primaryratrestrictions);
} else if (!strcmp("secondaryRatRestrictions", field->name) &&
row[i] != NULL) {
std ::vector<RatType> secondaryratrestrictions;
nlohmann::json::parse(row[i]).get_to(secondaryratrestrictions);
accessandmobilitysubscriptiondata.setSecondaryRatRestrictions(
secondaryratrestrictions);
} else if (!strcmp("edrxParametersList", field->name) && row[i] != NULL) {
std ::vector<EdrxParameters> edrxparameterslist;
nlohmann::json::parse(row[i]).get_to(edrxparameterslist);
accessandmobilitysubscriptiondata.setEdrxParametersList(
edrxparameterslist);
} else if (!strcmp("ptwParametersList", field->name) && row[i] != NULL) {
std ::vector<PtwParameters> ptwparameterslist;
nlohmann::json::parse(row[i]).get_to(ptwparameterslist);
accessandmobilitysubscriptiondata.setPtwParametersList(
ptwparameterslist);
} else if (!strcmp("iabOperationAllowed", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setIabOperationAllowed(true);
else
accessandmobilitysubscriptiondata.setIabOperationAllowed(false);
} else if (!strcmp("wirelineForbiddenAreas", field->name) &&
row[i] != NULL) {
std ::vector<WirelineArea> wirelineforbiddenareas;
nlohmann::json::parse(row[i]).get_to(wirelineforbiddenareas);
accessandmobilitysubscriptiondata.setWirelineForbiddenAreas(
wirelineforbiddenareas);
} else if (!strcmp("wirelineServiceAreaRestriction", field->name) &&
row[i] != NULL) {
WirelineServiceAreaRestriction wirelineservicearearestriction;
nlohmann::json::parse(row[i]).get_to(wirelineservicearearestriction);
accessandmobilitysubscriptiondata.setWirelineServiceAreaRestriction(
wirelineservicearearestriction);
}
}
to_json(j, accessandmobilitysubscriptiondata);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug(
"AccessAndMobilitySubscriptionData GET - json:\n\"%s\"", out.c_str());
} else {
Logger::udr_server().error("AccessAndMobilitySubscriptionData no data!");
}
mysql_free_result(res);
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
#ifndef ACCESS_AND_MOBILITY_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #ifndef ACCESS_AND_MOBILITY_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#define ACCESS_AND_MOBILITY_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #define ACCESS_AND_MOBILITY_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#include <AccessAndMobilitySubscriptionDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessAndMobilitySubscriptionDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AccessAndMobilitySubscriptionData.h"
#include <mysql/mysql.h>
#include "AccessAndMobilitySubscriptionData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -49,7 +45,7 @@ class AccessAndMobilitySubscriptionDataDocumentApiImpl ...@@ -49,7 +45,7 @@ class AccessAndMobilitySubscriptionDataDocumentApiImpl
public: public:
AccessAndMobilitySubscriptionDataDocumentApiImpl( AccessAndMobilitySubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql); std::string address);
~AccessAndMobilitySubscriptionDataDocumentApiImpl() {} ~AccessAndMobilitySubscriptionDataDocumentApiImpl() {}
void query_am_data( void query_am_data(
...@@ -59,9 +55,6 @@ class AccessAndMobilitySubscriptionDataDocumentApiImpl ...@@ -59,9 +55,6 @@ class AccessAndMobilitySubscriptionDataDocumentApiImpl
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch, const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince, const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -20,21 +20,19 @@ ...@@ -20,21 +20,19 @@
#ifndef _AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_ #ifndef _AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#define _AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_ #define _AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#include <AmfSubscriptionInfoDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AmfSubscriptionInfoDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef APPLICATION_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef APPLICATION_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define APPLICATION_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define APPLICATION_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <ApplicationDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <ApplicationDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <memory>
#include "ApplicationDataSubs.h" #include "ApplicationDataSubs.h"
#include "DataFilter.h" #include "DataFilter.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef AUTHENTICATION_SO_R_DOCUMENT_API_IMPL_H_ #ifndef AUTHENTICATION_SO_R_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_SO_R_DOCUMENT_API_IMPL_H_ #define AUTHENTICATION_SO_R_DOCUMENT_API_IMPL_H_
#include <AuthenticationSoRDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationSoRDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SorData.h"
#include "SorData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "AuthenticationStatusDocumentApiImpl.h" #include "AuthenticationStatusDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -25,161 +24,43 @@ using namespace oai::udr::model; ...@@ -25,161 +24,43 @@ using namespace oai::udr::model;
AuthenticationStatusDocumentApiImpl::AuthenticationStatusDocumentApiImpl( AuthenticationStatusDocumentApiImpl::AuthenticationStatusDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: AuthenticationStatusDocumentApi(rtr), : AuthenticationStatusDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void AuthenticationStatusDocumentApiImpl::create_authentication_status( void AuthenticationStatusDocumentApiImpl::create_authentication_status(
const std::string &ueId, const AuthEvent &authEvent, const std::string &ueId, const AuthEvent &authEvent,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
// response.send(Pistache::Http::Code::Ok, "create_authentication_status\n"); nlohmann::json response_data = {};
MYSQL_RES *res = NULL; Pistache::Http::Code code = {};
MYSQL_ROW row; m_udr_app->handle_create_authentication_status(ueId, authEvent, response_data,
code);
const std::string select_AuthenticationStatus =
"select * from AuthenticationStatus WHERE ueid='" + ueId + "'";
std::string query;
nlohmann::json j;
if (mysql_real_query(mysql_WitcommUDRDB, select_AuthenticationStatus.c_str(),
(unsigned long)select_AuthenticationStatus.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_AuthenticationStatus.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
if (res == NULL) { response.send(code, response_data.dump());
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_AuthenticationStatus.c_str());
return;
}
if (mysql_num_rows(res)) {
query = "update AuthenticationStatus set nfInstanceId='" +
authEvent.getNfInstanceId() + "'" +
",success=" + (authEvent.isSuccess() ? "1" : "0") + ",timeStamp='" +
authEvent.getTimeStamp() + "'" + ",authType='" +
authEvent.getAuthType() + "'" + ",servingNetworkName='" +
authEvent.getServingNetworkName() + "'" +
(authEvent.authRemovalIndIsSet()
? (authEvent.isAuthRemovalInd() ? ",authRemovalInd=1"
: ",authRemovalInd=0")
: "");
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
query += " where ueid='" + ueId + "'";
} else {
query = "insert into AuthenticationStatus set ueid='" + ueId + "'" +
",nfInstanceId='" + authEvent.getNfInstanceId() + "'" +
",success=" + (authEvent.isSuccess() ? "1" : "0") + ",timeStamp='" +
authEvent.getTimeStamp() + "'" + ",authType='" +
authEvent.getAuthType() + "'" + ",servingNetworkName='" +
authEvent.getServingNetworkName() + "'" +
(authEvent.authRemovalIndIsSet()
? (authEvent.isAuthRemovalInd() ? ",authRemovalInd=1"
: ",authRemovalInd=0")
: "");
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
}
mysql_free_result(res);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql create failure!SQL(%s)", query.c_str());
return;
}
response.send(Pistache::Http::Code::No_Content, "");
to_json(j, authEvent);
Logger::udr_server().debug("AuthenticationStatus PUT - json:\n\"%s\"",
j.dump().c_str());
} }
void AuthenticationStatusDocumentApiImpl::delete_authentication_status( void AuthenticationStatusDocumentApiImpl::delete_authentication_status(
const std::string &ueId, Pistache::Http::ResponseWriter &response) { const std::string &ueId, Pistache::Http::ResponseWriter &response) {
const std::string query = nlohmann::json response_data = {};
"DELETE from AuthenticationStatus WHERE ueid='" + ueId + "'"; Pistache::Http::Code code = {};
m_udr_app->handle_delete_authentication_status(ueId, response_data, code);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
response.send(Pistache::Http::Code::No_Content, ""); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
Logger::udr_server().debug("AuthenticationStatus DELETE - successful"); response.send(code, response_data.dump());
} }
void AuthenticationStatusDocumentApiImpl::query_authentication_status( void AuthenticationStatusDocumentApiImpl::query_authentication_status(
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_query_authentication_status(ueId, response_data, code);
nlohmann::json j;
AuthEvent authenticationstatus;
const std::string query =
"select * from AuthenticationStatus WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!");
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("nfInstanceId", field->name)) {
authenticationstatus.setNfInstanceId(row[i]);
} else if (!strcmp("success", field->name)) {
if (strcmp(row[i], "0"))
authenticationstatus.setSuccess(true);
else
authenticationstatus.setSuccess(false);
} else if (!strcmp("timeStamp", field->name)) {
authenticationstatus.setTimeStamp(row[i]);
} else if (!strcmp("authType", field->name)) {
// AuthType authtype;
// nlohmann::json::parse(row[i]).get_to(authtype);
authenticationstatus.setAuthType(row[i]);
} else if (!strcmp("servingNetworkName", field->name)) {
authenticationstatus.setServingNetworkName(row[i]);
} else if (!strcmp("authRemovalInd", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
authenticationstatus.setAuthRemovalInd(true);
else
authenticationstatus.setAuthRemovalInd(false);
}
}
to_json(j, authenticationstatus);
response.send(Pistache::Http::Code::Ok, j.dump());
Logger::udr_server().debug("AuthenticationStatus GET - json:\n\"%s\"",
j.dump().c_str());
} else {
Logger::udr_server().error("AuthenticationStatus no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
#ifndef AUTHENTICATION_STATUS_DOCUMENT_API_IMPL_H_ #ifndef AUTHENTICATION_STATUS_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_STATUS_DOCUMENT_API_IMPL_H_ #define AUTHENTICATION_STATUS_DOCUMENT_API_IMPL_H_
#include <AuthenticationStatusDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationStatusDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AuthEvent.h"
#include <mysql/mysql.h>
#include "AuthEvent.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -49,7 +45,7 @@ class AuthenticationStatusDocumentApiImpl ...@@ -49,7 +45,7 @@ class AuthenticationStatusDocumentApiImpl
public: public:
AuthenticationStatusDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, AuthenticationStatusDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, udr_app *udr_app_inst,
std::string address, MYSQL *mysql); std::string address);
~AuthenticationStatusDocumentApiImpl() {} ~AuthenticationStatusDocumentApiImpl() {}
void create_authentication_status(const std::string &ueId, void create_authentication_status(const std::string &ueId,
...@@ -63,9 +59,6 @@ class AuthenticationStatusDocumentApiImpl ...@@ -63,9 +59,6 @@ class AuthenticationStatusDocumentApiImpl
const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -12,11 +12,10 @@ ...@@ -12,11 +12,10 @@
*/ */
#include "AuthenticationSubscriptionDocumentApiImpl.h" #include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "PatchResult.h"
#include "logger.hpp"
#include <AuthenticationSubscription.h> #include <AuthenticationSubscription.h>
#include "PatchResult.h"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
#include "udr_config.hpp" #include "udr_config.hpp"
...@@ -29,82 +28,23 @@ using namespace oai::udr::model; ...@@ -29,82 +28,23 @@ using namespace oai::udr::model;
AuthenticationSubscriptionDocumentApiImpl:: AuthenticationSubscriptionDocumentApiImpl::
AuthenticationSubscriptionDocumentApiImpl( AuthenticationSubscriptionDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: AuthenticationSubscriptionDocumentApi(rtr), : AuthenticationSubscriptionDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void AuthenticationSubscriptionDocumentApiImpl:: void AuthenticationSubscriptionDocumentApiImpl::
modify_authentication_subscription( modify_authentication_subscription(
const std::string &ueId, const std::vector<PatchItem> &patchItem, const std::string &ueId, const std::vector<PatchItem> &patchItem,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
m_udr_app->handle_modify_authentication_subscription(ueId, patchItem,
const std::string select_Authenticationsubscription = response_data, code);
"select * from AuthenticationSubscription WHERE ueid='" + ueId + "'";
std::string query;
nlohmann::json j, tmp_j;
for (int i = 0; i < patchItem.size(); i++) {
if ((!strcmp(patchItem[i].getOp().c_str(), PATCH_OPERATION_REPLACE)) &&
patchItem[i].valueIsSet()) {
patchItem[i].getValue();
SequenceNumber sequencenumber;
nlohmann::json::parse(patchItem[i].getValue().c_str())
.get_to(sequencenumber);
if (mysql_real_query(
mysql_WitcommUDRDB, select_Authenticationsubscription.c_str(),
(unsigned long)select_Authenticationsubscription.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_Authenticationsubscription.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_Authenticationsubscription.c_str());
return;
}
if (mysql_num_rows(res)) {
nlohmann::json sequencenumber_j;
query = "update AuthenticationSubscription set sequenceNumber='";
to_json(sequencenumber_j, sequencenumber);
query += sequencenumber_j.dump() + "'";
query += " where ueid='" + ueId + "'";
} else {
Logger::udr_server().error(
"AuthenticationSubscription no data!SQL(%s)",
select_Authenticationsubscription.c_str());
}
mysql_free_result(res);
// Logger::udr_server().debug("modify content:
// %s",query.c_str());
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("update mysql failure!SQL(%s)",
query.c_str());
return;
}
}
to_json(tmp_j, patchItem[i]); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
j += tmp_j; response.send(code, response_data.dump());
}
std::string out = j.dump();
Logger::udr_server().debug("AuthenticationSubscription PATCH - json:\n\"%s\"",
out.c_str());
response.send(Pistache::Http::Code::No_Content, "");
} }
void AuthenticationSubscriptionDocumentApiImpl:: void AuthenticationSubscriptionDocumentApiImpl::
...@@ -112,91 +52,12 @@ void AuthenticationSubscriptionDocumentApiImpl:: ...@@ -112,91 +52,12 @@ void AuthenticationSubscriptionDocumentApiImpl::
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_read_authentication_subscription(ueId, response_data, code);
nlohmann::json j;
AuthenticationSubscription authenticationsubscription;
const std::string query =
"select * from AuthenticationSubscription WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("authenticationMethod", field->name)) {
// AuthMethod authenticationmethod;
// nlohmann::json::parse(row[i]).get_to(authenticationmethod);
authenticationsubscription.setAuthenticationMethod(row[i]);
} else if (!strcmp("encPermanentKey", field->name) && row[i] != NULL) {
authenticationsubscription.setEncPermanentKey(row[i]);
} else if (!strcmp("protectionParameterId", field->name) &&
row[i] != NULL) {
authenticationsubscription.setProtectionParameterId(row[i]);
} else if (!strcmp("sequenceNumber", field->name) && row[i] != NULL) {
SequenceNumber sequencenumber;
nlohmann::json::parse(row[i]).get_to(sequencenumber);
authenticationsubscription.setSequenceNumber(sequencenumber);
} else if (!strcmp("authenticationManagementField", field->name) &&
row[i] != NULL) {
authenticationsubscription.setAuthenticationManagementField(row[i]);
} else if (!strcmp("algorithmId", field->name) && row[i] != NULL) {
authenticationsubscription.setAlgorithmId(row[i]);
} else if (!strcmp("encOpcKey", field->name) && row[i] != NULL) {
authenticationsubscription.setEncOpcKey(row[i]);
} else if (!strcmp("encTopcKey", field->name) && row[i] != NULL) {
authenticationsubscription.setEncTopcKey(row[i]);
} else if (!strcmp("vectorGenerationInHss", field->name) &&
row[i] != NULL) {
std::cout << row[i] << std::endl;
if (strcmp(row[i], "0"))
authenticationsubscription.setVectorGenerationInHss(true);
else
authenticationsubscription.setVectorGenerationInHss(false);
} else if (!strcmp("n5gcAuthMethod", field->name) && row[i] != NULL) {
// AuthMethod n5gcauthmethod;
// nlohmann::json::parse(row[i]).get_to(n5gcauthmethod);
authenticationsubscription.setN5gcAuthMethod(row[i]);
} else if (!strcmp("rgAuthenticationInd", field->name) &&
row[i] != NULL) {
std::cout << row[i] << std::endl;
if (strcmp(row[i], "0"))
authenticationsubscription.setRgAuthenticationInd(true);
else
authenticationsubscription.setRgAuthenticationInd(false);
} else if (!strcmp("supi", field->name) && row[i] != NULL) {
authenticationsubscription.setSupi(row[i]);
}
}
to_json(j, authenticationsubscription);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("AuthenticationSubscription GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("AuthenticationSubscription no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,23 +20,19 @@ ...@@ -20,23 +20,19 @@
#ifndef AUTHENTICATION_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef AUTHENTICATION_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define AUTHENTICATION_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <AuthenticationSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include <mysql/mysql.h>
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -52,7 +48,7 @@ class AuthenticationSubscriptionDocumentApiImpl ...@@ -52,7 +48,7 @@ class AuthenticationSubscriptionDocumentApiImpl
public: public:
AuthenticationSubscriptionDocumentApiImpl( AuthenticationSubscriptionDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql); std::string address);
~AuthenticationSubscriptionDocumentApiImpl() {} ~AuthenticationSubscriptionDocumentApiImpl() {}
void modify_authentication_subscription( void modify_authentication_subscription(
...@@ -63,9 +59,6 @@ class AuthenticationSubscriptionDocumentApiImpl ...@@ -63,9 +59,6 @@ class AuthenticationSubscriptionDocumentApiImpl
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef AUTHENTICATION_UPU_DOCUMENT_API_IMPL_H_ #ifndef AUTHENTICATION_UPU_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_UPU_DOCUMENT_API_IMPL_H_ #define AUTHENTICATION_UPU_DOCUMENT_API_IMPL_H_
#include <AuthenticationUPUDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationUPUDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "UpuData.h"
#include "UpuData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef BDT_DATA_STORE_API_IMPL_H_ #ifndef BDT_DATA_STORE_API_IMPL_H_
#define BDT_DATA_STORE_API_IMPL_H_ #define BDT_DATA_STORE_API_IMPL_H_
#include <BdtDataStoreApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <BdtDataStoreApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "BdtData.h" #include "BdtData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef BDT_POLICY_DATA_STORE_API_IMPL_H_ #ifndef BDT_POLICY_DATA_STORE_API_IMPL_H_
#define BDT_POLICY_DATA_STORE_API_IMPL_H_ #define BDT_POLICY_DATA_STORE_API_IMPL_H_
#include <BdtPolicyDataStoreApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <BdtPolicyDataStoreApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "BdtPolicyData.h" #include "BdtPolicyData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef CAGACK_DOCUMENT_API_IMPL_H_ #ifndef CAGACK_DOCUMENT_API_IMPL_H_
#define CAGACK_DOCUMENT_API_IMPL_H_ #define CAGACK_DOCUMENT_API_IMPL_H_
#include <CAGACKDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <CAGACKDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "CagAckData.h"
#include "CagAckData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef CAG_UPDATE_ACK_DOCUMENT_API_IMPL_H_ #ifndef CAG_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#define CAG_UPDATE_ACK_DOCUMENT_API_IMPL_H_ #define CAG_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#include <CAGUpdateAckDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <CAGUpdateAckDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "CagAckData.h"
#include "CagAckData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef CLASS5_GVN_GROUPS_INTERNAL_DOCUMENT_API_IMPL_H_ #ifndef CLASS5_GVN_GROUPS_INTERNAL_DOCUMENT_API_IMPL_H_
#define CLASS5_GVN_GROUPS_INTERNAL_DOCUMENT_API_IMPL_H_ #define CLASS5_GVN_GROUPS_INTERNAL_DOCUMENT_API_IMPL_H_
#include <Class5GVNGroupsInternalDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Class5GVNGroupsInternalDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "5GVnGroupConfiguration.h"
#include "5GVnGroupConfiguration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef CLASS5_GVN_GROUPS_STORE_API_IMPL_H_ #ifndef CLASS5_GVN_GROUPS_STORE_API_IMPL_H_
#define CLASS5_GVN_GROUPS_STORE_API_IMPL_H_ #define CLASS5_GVN_GROUPS_STORE_API_IMPL_H_
#include <Class5GVNGroupsStoreApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Class5GVNGroupsStoreApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "5GVnGroupConfiguration.h"
#include "5GVnGroupConfiguration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef CLASS5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_ #ifndef CLASS5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_
#define CLASS5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_ #define CLASS5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_
#include <Class5GVnGroupConfigurationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Class5GVnGroupConfigurationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "5GVnGroupConfiguration.h" #include "5GVnGroupConfiguration.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,14 +20,13 @@ ...@@ -20,14 +20,13 @@
#ifndef CONTEXT_DATA_DOCUMENT_API_IMPL_H_ #ifndef CONTEXT_DATA_DOCUMENT_API_IMPL_H_
#define CONTEXT_DATA_DOCUMENT_API_IMPL_H_ #define CONTEXT_DATA_DOCUMENT_API_IMPL_H_
#include <ContextDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <ContextDataDocumentApi.h> #include <memory>
#include <pistache/optional.h>
#include "ContextDataSetName.h" #include "ContextDataSetName.h"
#include "ContextDataSets.h" #include "ContextDataSets.h"
......
...@@ -20,15 +20,13 @@ ...@@ -20,15 +20,13 @@
#ifndef DELETE5_G_VN_GROUP_API_IMPL_H_ #ifndef DELETE5_G_VN_GROUP_API_IMPL_H_
#define DELETE5_G_VN_GROUP_API_IMPL_H_ #define DELETE5_G_VN_GROUP_API_IMPL_H_
#include <Delete5GVnGroupApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Delete5GVnGroupApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "udr_app.hpp" #include "udr_app.hpp"
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef ENHANCED_COVERAGE_RESTRICTION_DATA_API_IMPL_H_ #ifndef ENHANCED_COVERAGE_RESTRICTION_DATA_API_IMPL_H_
#define ENHANCED_COVERAGE_RESTRICTION_DATA_API_IMPL_H_ #define ENHANCED_COVERAGE_RESTRICTION_DATA_API_IMPL_H_
#include <EnhancedCoverageRestrictionDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EnhancedCoverageRestrictionDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "EnhancedCoverageRestrictionData.h"
#include "EnhancedCoverageRestrictionData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,15 +20,13 @@ ...@@ -20,15 +20,13 @@
#ifndef EVENT_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_ #ifndef EVENT_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#define EVENT_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_ #define EVENT_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#include <EventAMFSubscriptionInfoDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventAMFSubscriptionInfoDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "udr_app.hpp" #include "udr_app.hpp"
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef EVENT_EXPOSURE_DATA_DOCUMENT_API_IMPL_H_ #ifndef EVENT_EXPOSURE_DATA_DOCUMENT_API_IMPL_H_
#define EVENT_EXPOSURE_DATA_DOCUMENT_API_IMPL_H_ #define EVENT_EXPOSURE_DATA_DOCUMENT_API_IMPL_H_
#include <EventExposureDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "EeProfileData.h"
#include "EeProfileData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,23 +20,22 @@ ...@@ -20,23 +20,22 @@
#ifndef EVENT_EXPOSURE_GROUP_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef EVENT_EXPOSURE_GROUP_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define EVENT_EXPOSURE_GROUP_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define EVENT_EXPOSURE_GROUP_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <EventExposureGroupSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <EventExposureGroupSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <memory>
#include "EeSubscription.h" #include "EeSubscription.h"
//#include "Object.h" //#include "Object.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef EVENT_EXPOSURE_GROUP_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef EVENT_EXPOSURE_GROUP_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define EVENT_EXPOSURE_GROUP_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define EVENT_EXPOSURE_GROUP_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <EventExposureGroupSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureGroupSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "EeSubscription.h"
#include "EeSubscription.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,23 +20,22 @@ ...@@ -20,23 +20,22 @@
#ifndef EVENT_EXPOSURE_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef EVENT_EXPOSURE_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define EVENT_EXPOSURE_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define EVENT_EXPOSURE_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <EventExposureSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <EventExposureSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <memory>
#include "EeSubscription.h" #include "EeSubscription.h"
//#include "Object.h" //#include "Object.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef EVENT_EXPOSURE_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef EVENT_EXPOSURE_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define EVENT_EXPOSURE_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define EVENT_EXPOSURE_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <EventExposureSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "EeSubscription.h"
#include "EeSubscription.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef EXPOSURE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef EXPOSURE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define EXPOSURE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define EXPOSURE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <ExposureDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <ExposureDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <memory>
#include "ExposureDataSubscription.h" #include "ExposureDataSubscription.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef GROUP_IDENTIFIERS_API_IMPL_H_ #ifndef GROUP_IDENTIFIERS_API_IMPL_H_
#define GROUP_IDENTIFIERS_API_IMPL_H_ #define GROUP_IDENTIFIERS_API_IMPL_H_
#include <GroupIdentifiersApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <GroupIdentifiersApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "GroupIdentifiers.h"
#include "GroupIdentifiers.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,21 +20,19 @@ ...@@ -20,21 +20,19 @@
#ifndef IPSMGW_REGISTRATION_DOCUMENT_API_IMPL_H_ #ifndef IPSMGW_REGISTRATION_DOCUMENT_API_IMPL_H_
#define IPSMGW_REGISTRATION_DOCUMENT_API_IMPL_H_ #define IPSMGW_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <IPSMGWRegistrationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IPSMGWRegistrationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "IpSmGwRegistration.h" #include "IpSmGwRegistration.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef IPTV_CONFIGURATION_DATA_STORE_API_IMPL_H_ #ifndef IPTV_CONFIGURATION_DATA_STORE_API_IMPL_H_
#define IPTV_CONFIGURATION_DATA_STORE_API_IMPL_H_ #define IPTV_CONFIGURATION_DATA_STORE_API_IMPL_H_
#include <IPTVConfigurationDataStoreApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IPTVConfigurationDataStoreApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "IptvConfigData.h" #include "IptvConfigData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "Snssai.h" #include "Snssai.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_APPLICATION_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_APPLICATION_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_APPLICATION_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_APPLICATION_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <IndividualApplicationDataSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualApplicationDataSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ApplicationDataSubs.h" #include "ApplicationDataSubs.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_APPLIED_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_APPLIED_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_APPLIED_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_APPLIED_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualAppliedBDTPolicyDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualAppliedBDTPolicyDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "BdtPolicyData.h" #include "BdtPolicyData.h"
#include "BdtPolicyDataPatch.h" #include "BdtPolicyDataPatch.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_BDT_POLICY_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualBDTPolicyDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualBDTPolicyDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "BdtPolicyData.h" #include "BdtPolicyData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_BDT_DATA_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_BDT_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_BDT_DATA_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_BDT_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualBdtDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualBdtDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "BdtData.h" #include "BdtData.h"
#include "BdtDataPatch.h" #include "BdtDataPatch.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_EXPOSURE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_EXPOSURE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_EXPOSURE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_EXPOSURE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <IndividualExposureDataSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualExposureDataSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ExposureDataSubscription.h" #include "ExposureDataSubscription.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_IPTV_CONFIGURATION_DATA_API_IMPL_H_ #ifndef INDIVIDUAL_IPTV_CONFIGURATION_DATA_API_IMPL_H_
#define INDIVIDUAL_IPTV_CONFIGURATION_DATA_API_IMPL_H_ #define INDIVIDUAL_IPTV_CONFIGURATION_DATA_API_IMPL_H_
#include <IndividualIPTVConfigurationDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualIPTVConfigurationDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "IptvConfigData.h" #include "IptvConfigData.h"
#include "IptvConfigDataPatch.h" #include "IptvConfigDataPatch.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_IPTV_CONFIGURATION_DATA_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_IPTV_CONFIGURATION_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_IPTV_CONFIGURATION_DATA_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_IPTV_CONFIGURATION_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualIPTVConfigurationDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualIPTVConfigurationDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "IptvConfigData.h" #include "IptvConfigData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_INFLUENCE_DATA_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_INFLUENCE_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_INFLUENCE_DATA_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_INFLUENCE_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualInfluenceDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualInfluenceDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "TrafficInfluData.h" #include "TrafficInfluData.h"
#include "TrafficInfluDataPatch.h" #include "TrafficInfluDataPatch.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_INFLUENCE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_INFLUENCE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_INFLUENCE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_INFLUENCE_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <IndividualInfluenceDataSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualInfluenceDataSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "TrafficInfluSub.h" #include "TrafficInfluSub.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_PFD_DATA_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_PFD_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_PFD_DATA_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_PFD_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualPFDDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualPFDDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "PfdDataForAppExt.h" #include "PfdDataForAppExt.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_POLICY_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef INDIVIDUAL_POLICY_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_POLICY_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define INDIVIDUAL_POLICY_DATA_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <IndividualPolicyDataSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualPolicyDataSubscriptionDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "PolicyDataSubscription.h" #include "PolicyDataSubscription.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef INFLUENCE_DATA_STORE_API_IMPL_H_ #ifndef INFLUENCE_DATA_STORE_API_IMPL_H_
#define INFLUENCE_DATA_STORE_API_IMPL_H_ #define INFLUENCE_DATA_STORE_API_IMPL_H_
#include <InfluenceDataStoreApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <InfluenceDataStoreApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "Snssai.h" #include "Snssai.h"
#include "TrafficInfluData.h" #include "TrafficInfluData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef INFLUENCE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef INFLUENCE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define INFLUENCE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define INFLUENCE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <InfluenceDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <InfluenceDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "Snssai.h" #include "Snssai.h"
#include "TrafficInfluSub.h" #include "TrafficInfluSub.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef LCS_BROADCAST_ASSISTANCE_SUBSCRIPTION_DATA_API_IMPL_H_ #ifndef LCS_BROADCAST_ASSISTANCE_SUBSCRIPTION_DATA_API_IMPL_H_
#define LCS_BROADCAST_ASSISTANCE_SUBSCRIPTION_DATA_API_IMPL_H_ #define LCS_BROADCAST_ASSISTANCE_SUBSCRIPTION_DATA_API_IMPL_H_
#include <LCSBroadcastAssistanceSubscriptionDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <LCSBroadcastAssistanceSubscriptionDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "LcsBroadcastAssistanceTypesData.h" #include "LcsBroadcastAssistanceTypesData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef LCS_MOBILE_ORIGINATED_SUBSCRIPTION_DATA_API_IMPL_H_ #ifndef LCS_MOBILE_ORIGINATED_SUBSCRIPTION_DATA_API_IMPL_H_
#define LCS_MOBILE_ORIGINATED_SUBSCRIPTION_DATA_API_IMPL_H_ #define LCS_MOBILE_ORIGINATED_SUBSCRIPTION_DATA_API_IMPL_H_
#include <LCSMobileOriginatedSubscriptionDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <LCSMobileOriginatedSubscriptionDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "LcsMoData.h"
#include "LcsMoData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef LCS_PRIVACY_SUBSCRIPTION_DATA_API_IMPL_H_ #ifndef LCS_PRIVACY_SUBSCRIPTION_DATA_API_IMPL_H_
#define LCS_PRIVACY_SUBSCRIPTION_DATA_API_IMPL_H_ #define LCS_PRIVACY_SUBSCRIPTION_DATA_API_IMPL_H_
#include <LCSPrivacySubscriptionDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <LCSPrivacySubscriptionDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "LcsPrivacyData.h"
#include "LcsPrivacyData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,21 +20,19 @@ ...@@ -20,21 +20,19 @@
#ifndef MESSAGE_WAITING_DATA_DOCUMENT_API_IMPL_H_ #ifndef MESSAGE_WAITING_DATA_DOCUMENT_API_IMPL_H_
#define MESSAGE_WAITING_DATA_DOCUMENT_API_IMPL_H_ #define MESSAGE_WAITING_DATA_DOCUMENT_API_IMPL_H_
#include <MessageWaitingDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <MessageWaitingDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "MessageWaitingData.h" #include "MessageWaitingData.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,21 +20,19 @@ ...@@ -20,21 +20,19 @@
#ifndef MODIFY5_G_VN_GROUP_API_IMPL_H_ #ifndef MODIFY5_G_VN_GROUP_API_IMPL_H_
#define MODIFY5_G_VN_GROUP_API_IMPL_H_ #define MODIFY5_G_VN_GROUP_API_IMPL_H_
#include <Modify5GVnGroupApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Modify5GVnGroupApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef NSSAIACK_DOCUMENT_API_IMPL_H_ #ifndef NSSAIACK_DOCUMENT_API_IMPL_H_
#define NSSAIACK_DOCUMENT_API_IMPL_H_ #define NSSAIACK_DOCUMENT_API_IMPL_H_
#include <NSSAIACKDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <NSSAIACKDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "NssaiAckData.h"
#include "NssaiAckData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef NSSAI_UPDATE_ACK_DOCUMENT_API_IMPL_H_ #ifndef NSSAI_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#define NSSAI_UPDATE_ACK_DOCUMENT_API_IMPL_H_ #define NSSAI_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#include <NSSAIUpdateAckDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <NSSAIUpdateAckDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "NssaiAckData.h"
#include "NssaiAckData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,22 +20,20 @@ ...@@ -20,22 +20,20 @@
#ifndef OPERATOR_SPECIFIC_DATA_CONTAINER_DOCUMENT_API_IMPL_H_ #ifndef OPERATOR_SPECIFIC_DATA_CONTAINER_DOCUMENT_API_IMPL_H_
#define OPERATOR_SPECIFIC_DATA_CONTAINER_DOCUMENT_API_IMPL_H_ #define OPERATOR_SPECIFIC_DATA_CONTAINER_DOCUMENT_API_IMPL_H_
#include <OperatorSpecificDataContainerDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <OperatorSpecificDataContainerDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "OperatorSpecificDataContainer.h" #include "OperatorSpecificDataContainer.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,23 +20,21 @@ ...@@ -20,23 +20,21 @@
#ifndef OPERATOR_SPECIFIC_DATA_DOCUMENT_API_IMPL_H_ #ifndef OPERATOR_SPECIFIC_DATA_DOCUMENT_API_IMPL_H_
#define OPERATOR_SPECIFIC_DATA_DOCUMENT_API_IMPL_H_ #define OPERATOR_SPECIFIC_DATA_DOCUMENT_API_IMPL_H_
#include <OperatorSpecificDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <OperatorSpecificDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <map> #include <map>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "OperatorSpecificDataContainer.h" #include "OperatorSpecificDataContainer.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef PFD_DATA_STORE_API_IMPL_H_ #ifndef PFD_DATA_STORE_API_IMPL_H_
#define PFD_DATA_STORE_API_IMPL_H_ #define PFD_DATA_STORE_API_IMPL_H_
#include <PFDDataStoreApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <PFDDataStoreApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "PfdDataForAppExt.h" #include "PfdDataForAppExt.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef PARAMETER_PROVISION_DOCUMENT_API_IMPL_H_ #ifndef PARAMETER_PROVISION_DOCUMENT_API_IMPL_H_
#define PARAMETER_PROVISION_DOCUMENT_API_IMPL_H_ #define PARAMETER_PROVISION_DOCUMENT_API_IMPL_H_
#include <ParameterProvisionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <ParameterProvisionDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "PpData.h" #include "PpData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef PDU_SESSION_MANAGEMENT_DATA_API_IMPL_H_ #ifndef PDU_SESSION_MANAGEMENT_DATA_API_IMPL_H_
#define PDU_SESSION_MANAGEMENT_DATA_API_IMPL_H_ #define PDU_SESSION_MANAGEMENT_DATA_API_IMPL_H_
#include <PduSessionManagementDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <PduSessionManagementDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "Ipv6Prefix.h" #include "Ipv6Prefix.h"
#include "PduSessionManagementData.h" #include "PduSessionManagementData.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef PLMN_UE_POLICY_SET_DOCUMENT_API_IMPL_H_ #ifndef PLMN_UE_POLICY_SET_DOCUMENT_API_IMPL_H_
#define PLMN_UE_POLICY_SET_DOCUMENT_API_IMPL_H_ #define PLMN_UE_POLICY_SET_DOCUMENT_API_IMPL_H_
#include <PlmnUePolicySetDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <PlmnUePolicySetDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "UePolicySet.h" #include "UePolicySet.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef POLICY_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef POLICY_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define POLICY_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define POLICY_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <PolicyDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <PolicyDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <memory>
#include "PolicyDataSubscription.h" #include "PolicyDataSubscription.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,14 +20,13 @@ ...@@ -20,14 +20,13 @@
#ifndef PROVISIONED_DATA_DOCUMENT_API_IMPL_H_ #ifndef PROVISIONED_DATA_DOCUMENT_API_IMPL_H_
#define PROVISIONED_DATA_DOCUMENT_API_IMPL_H_ #define PROVISIONED_DATA_DOCUMENT_API_IMPL_H_
#include <ProvisionedDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <ProvisionedDataDocumentApi.h> #include <memory>
#include <pistache/optional.h>
#include "DataSetName.h" #include "DataSetName.h"
#include "ProvisionedDataSets.h" #include "ProvisionedDataSets.h"
......
...@@ -20,21 +20,19 @@ ...@@ -20,21 +20,19 @@
#ifndef PROVISIONED_PARAMETER_DATA_DOCUMENT_API_IMPL_H_ #ifndef PROVISIONED_PARAMETER_DATA_DOCUMENT_API_IMPL_H_
#define PROVISIONED_PARAMETER_DATA_DOCUMENT_API_IMPL_H_ #define PROVISIONED_PARAMETER_DATA_DOCUMENT_API_IMPL_H_
#include <ProvisionedParameterDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <ProvisionedParameterDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef QUERY5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_ #ifndef QUERY5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_
#define QUERY5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_ #define QUERY5_G_VN_GROUP_CONFIGURATION_DOCUMENT_API_IMPL_H_
#include <Query5GVnGroupConfigurationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Query5GVnGroupConfigurationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "5GVnGroupConfiguration.h"
#include "5GVnGroupConfiguration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef QUERY_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_ #ifndef QUERY_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#define QUERY_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_ #define QUERY_AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#include <QueryAMFSubscriptionInfoDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryAMFSubscriptionInfoDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AmfSubscriptionInfo.h"
#include "AmfSubscriptionInfo.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef QUERY_IDENTITY_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_ #ifndef QUERY_IDENTITY_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_
#define QUERY_IDENTITY_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_ #define QUERY_IDENTITY_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_
#include <QueryIdentityDataBySUPIOrGPSIDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryIdentityDataBySUPIOrGPSIDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AppPortId.h" #include "AppPortId.h"
#include "IdentityData.h" #include "IdentityData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef QUERY_NIDD_AUTHORIZATION_DATA_GPSI_OR_EXTERNAL_GROUP_IDENTIFIER_DOCUMENT_API_IMPL_H_ #ifndef QUERY_NIDD_AUTHORIZATION_DATA_GPSI_OR_EXTERNAL_GROUP_IDENTIFIER_DOCUMENT_API_IMPL_H_
#define QUERY_NIDD_AUTHORIZATION_DATA_GPSI_OR_EXTERNAL_GROUP_IDENTIFIER_DOCUMENT_API_IMPL_H_ #define QUERY_NIDD_AUTHORIZATION_DATA_GPSI_OR_EXTERNAL_GROUP_IDENTIFIER_DOCUMENT_API_IMPL_H_
#include <QueryNIDDAuthorizationDataGPSIOrExternalGroupIdentifierDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryNIDDAuthorizationDataGPSIOrExternalGroupIdentifierDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "AuthorizationData.h" #include "AuthorizationData.h"
#include "Snssai.h" #include "Snssai.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef QUERY_ODB_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_ #ifndef QUERY_ODB_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_
#define QUERY_ODB_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_ #define QUERY_ODB_DATA_BY_SUPI_OR_GPSI_DOCUMENT_API_IMPL_H_
#include <QueryODBDataBySUPIOrGPSIDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryODBDataBySUPIOrGPSIDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "OdbData.h"
#include "OdbData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,19 @@ ...@@ -20,20 +20,19 @@
#ifndef RETRIEVAL_OF_SHARED_DATA_API_IMPL_H_ #ifndef RETRIEVAL_OF_SHARED_DATA_API_IMPL_H_
#define RETRIEVAL_OF_SHARED_DATA_API_IMPL_H_ #define RETRIEVAL_OF_SHARED_DATA_API_IMPL_H_
#include <RetrievalOfSharedDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <RetrievalOfSharedDataApi.h>
#include <pistache/optional.h> #include <memory>
#include "ProblemDetails.h" #include "ProblemDetails.h"
//#include "Set.h" //#include "Set.h"
#include <string> #include <string>
#include "SharedData.h"
#include "SharedData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "SDMSubscriptionDocumentApiImpl.h" #include "SDMSubscriptionDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -25,12 +24,10 @@ using namespace oai::udr::model; ...@@ -25,12 +24,10 @@ using namespace oai::udr::model;
SDMSubscriptionDocumentApiImpl::SDMSubscriptionDocumentApiImpl( SDMSubscriptionDocumentApiImpl::SDMSubscriptionDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: SDMSubscriptionDocumentApi(rtr), : SDMSubscriptionDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void SDMSubscriptionDocumentApiImpl::modifysdm_subscription( void SDMSubscriptionDocumentApiImpl::modifysdm_subscription(
const std::string &ueId, const std::string &subsId, const std::string &ueId, const std::string &subsId,
...@@ -42,254 +39,34 @@ void SDMSubscriptionDocumentApiImpl::modifysdm_subscription( ...@@ -42,254 +39,34 @@ void SDMSubscriptionDocumentApiImpl::modifysdm_subscription(
void SDMSubscriptionDocumentApiImpl::querysdm_subscription( void SDMSubscriptionDocumentApiImpl::querysdm_subscription(
const std::string &ueId, const std::string &subsId, const std::string &ueId, const std::string &subsId,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_query_sdm_subscription(ueId, subsId, response_data, code);
nlohmann::json j;
SdmSubscription SdmSubscriptions;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid='" +
ueId + "' AND subsId=" + subsId;
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
if (row != NULL) { response.send(code, response_data.dump());
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("nfInstanceId", field->name)) {
SdmSubscriptions.setNfInstanceId(row[i]);
} else if (!strcmp("implicitUnsubscribe", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
SdmSubscriptions.setImplicitUnsubscribe(true);
else
SdmSubscriptions.setImplicitUnsubscribe(false);
} else if (!strcmp("expires", field->name) && row[i] != NULL) {
SdmSubscriptions.setExpires(row[i]);
} else if (!strcmp("callbackReference", field->name)) {
SdmSubscriptions.setCallbackReference(row[i]);
} else if (!strcmp("amfServiceName", field->name) && row[i] != NULL) {
ServiceName amfservicename;
nlohmann::json::parse(row[i]).get_to(amfservicename);
SdmSubscriptions.setAmfServiceName(amfservicename);
} else if (!strcmp("monitoredResourceUris", field->name)) {
std::vector<std::string> monitoredresourceuris;
nlohmann::json::parse(row[i]).get_to(monitoredresourceuris);
SdmSubscriptions.setMonitoredResourceUris(monitoredresourceuris);
} else if (!strcmp("singleNssai", field->name) && row[i] != NULL) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
SdmSubscriptions.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", field->name) && row[i] != NULL) {
SdmSubscriptions.setDnn(row[i]);
} else if (!strcmp("subscriptionId", field->name) && row[i] != NULL) {
SdmSubscriptions.setSubscriptionId(row[i]);
} else if (!strcmp("plmnId", field->name) && row[i] != NULL) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
SdmSubscriptions.setPlmnId(plmnid);
} else if (!strcmp("immediateReport", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
SdmSubscriptions.setImmediateReport(true);
else
SdmSubscriptions.setImmediateReport(false);
} else if (!strcmp("report", field->name) && row[i] != NULL) {
SubscriptionDataSets report;
nlohmann::json::parse(row[i]).get_to(report);
SdmSubscriptions.setReport(report);
} else if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
SdmSubscriptions.setSupportedFeatures(row[i]);
} else if (!strcmp("contextInfo", field->name) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
SdmSubscriptions.setContextInfo(contextinfo);
}
}
to_json(j, SdmSubscriptions);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscription GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("SdmSubscription no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
} }
void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions( void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(
const std::string &ueId, const std::string &subsId, const std::string &ueId, const std::string &subsId,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
nlohmann::json j; Pistache::Http::Code code = {};
ProblemDetails problemdetails; m_udr_app->handle_remove_sdm_subscription(ueId, subsId, response_data, code);
const std::string select_query =
"SELECT * from SdmSubscriptions WHERE ueid='" + ueId +
"' AND subsId=" + subsId;
const std::string query = "DELETE from SdmSubscriptions WHERE ueid='" + ueId +
"' AND subsId=" + subsId;
if (mysql_real_query(mysql_WitcommUDRDB, select_query.c_str(),
(unsigned long)select_query.size())) {
problemdetails.setCause("USER_NOT_FOUND");
to_json(j, problemdetails);
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
response.send(Pistache::Http::Code::Not_Found, j.dump());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
problemdetails.setCause("USER_NOT_FOUND");
to_json(j, problemdetails);
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
response.send(Pistache::Http::Code::Not_Found, j.dump());
return;
}
if (!mysql_num_rows(res)) {
problemdetails.setCause("DATA_NOT_FOUND");
to_json(j, problemdetails);
response.send(Pistache::Http::Code::Not_Found, j.dump());
return;
}
mysql_free_result(res);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
problemdetails.setCause("USER_NOT_FOUND");
to_json(j, problemdetails);
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
response.send(Pistache::Http::Code::Not_Found, j.dump());
return;
}
response.send(Pistache::Http::Code::No_Content, "");
Logger::udr_server().debug("SdmSubscription DELETE - successful"); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions( void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(
const std::string &ueId, const std::string &subsId, const std::string &ueId, const std::string &subsId,
SdmSubscription &sdmSubscription, SdmSubscription &sdmSubscription,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
m_udr_app->handle_update_sdm_subscription(ueId, subsId, sdmSubscription,
const std::string select_query = response_data, code);
"SELECT * from SdmSubscriptions WHERE ueid='" + ueId +
"' AND subsId=" + subsId;
std::string query;
nlohmann::json j;
ProblemDetails problemdetails;
if (mysql_real_query(mysql_WitcommUDRDB, select_query.c_str(),
(unsigned long)select_query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
if (mysql_num_rows(res)) {
nlohmann::json MonitoredResourceUris_json(
sdmSubscription.getMonitoredResourceUris());
query =
"update SdmSubscriptions set nfInstanceId='" +
sdmSubscription.getNfInstanceId() + "'" +
(sdmSubscription.implicitUnsubscribeIsSet()
? (sdmSubscription.isImplicitUnsubscribe()
? ",implicitUnsubscribe=1"
: ",implicitUnsubscribe=0")
: "") +
(sdmSubscription.expiresIsSet()
? ",expires='" + sdmSubscription.getExpires() + "'"
: "") +
",callbackReference='" + sdmSubscription.getCallbackReference() + "'" +
(sdmSubscription.dnnIsSet() ? ",dnn='" + sdmSubscription.getDnn() + "'"
: "") +
(sdmSubscription.subscriptionIdIsSet()
? ",subscriptionId='" + sdmSubscription.getSubscriptionId() + "'"
: "") +
(sdmSubscription.immediateReportIsSet()
? (sdmSubscription.isImmediateReport() ? ",immediateReport=1"
: ",immediateReport=0")
: "") +
(sdmSubscription.supportedFeaturesIsSet()
? ",supportedFeatures='" + sdmSubscription.getSupportedFeatures() +
"'"
: "");
if (sdmSubscription.amfServiceNameIsSet()) {
to_json(j, sdmSubscription.getAmfServiceName());
query += ",amfServiceName='" + j.dump() + "'";
}
if (sdmSubscription.singleNssaiIsSet()) {
to_json(j, sdmSubscription.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
}
if (sdmSubscription.plmnIdIsSet()) {
to_json(j, sdmSubscription.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
}
if (sdmSubscription.reportIsSet()) {
to_json(j, sdmSubscription.getReport());
query += ",report='" + j.dump() + "'";
}
if (sdmSubscription.contextInfoIsSet()) {
to_json(j, sdmSubscription.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
query +=
",monitoredResourceUris='" + MonitoredResourceUris_json.dump() + "'";
query += " where ueid='" + ueId + "' AND subsId=" + subsId;
} else {
to_json(j, problemdetails);
response.send(Pistache::Http::Code::Not_Found, j.dump());
mysql_free_result(res);
return;
}
mysql_free_result(res);
// std::cout << query << std::endl;
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
response.send(Pistache::Http::Code::No_Content, "");
to_json(j, sdmSubscription); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
std::string out = j.dump(); response.send(code, response_data.dump());
Logger::udr_server().debug("SdmSubscription PUT - json:\n\"%s\"",
out.c_str());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,25 +20,22 @@ ...@@ -20,25 +20,22 @@
#ifndef SDM_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #ifndef SDM_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define SDM_SUBSCRIPTION_DOCUMENT_API_IMPL_H_ #define SDM_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <SDMSubscriptionDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <SDMSubscriptionDocumentApi.h> #include <memory>
#include <pistache/optional.h>
//#include "Object.h" //#include "Object.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "SdmSubscription.h" #include "SdmSubscription.h"
#include <mysql/mysql.h>
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -53,8 +50,7 @@ class SDMSubscriptionDocumentApiImpl ...@@ -53,8 +50,7 @@ class SDMSubscriptionDocumentApiImpl
public: public:
SDMSubscriptionDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, SDMSubscriptionDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address, udr_app *udr_app_inst, std::string address);
MYSQL *mysql);
~SDMSubscriptionDocumentApiImpl() {} ~SDMSubscriptionDocumentApiImpl() {}
void modifysdm_subscription( void modifysdm_subscription(
...@@ -71,9 +67,6 @@ class SDMSubscriptionDocumentApiImpl ...@@ -71,9 +67,6 @@ class SDMSubscriptionDocumentApiImpl
const std::string &subsId, const std::string &subsId,
SdmSubscription &sdmSubscription, SdmSubscription &sdmSubscription,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "SDMSubscriptionsCollectionApiImpl.h" #include "SDMSubscriptionsCollectionApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -25,224 +24,32 @@ using namespace oai::udr::model; ...@@ -25,224 +24,32 @@ using namespace oai::udr::model;
SDMSubscriptionsCollectionApiImpl::SDMSubscriptionsCollectionApiImpl( SDMSubscriptionsCollectionApiImpl::SDMSubscriptionsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: SDMSubscriptionsCollectionApi(rtr), : SDMSubscriptionsCollectionApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions( void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(
const std::string &ueId, SdmSubscription &sdmSubscription, const std::string &ueId, SdmSubscription &sdmSubscription,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
nlohmann::json j; m_udr_app->handle_create_sdm_subscriptions(ueId, sdmSubscription,
response_data, code);
int32_t subsId = 0;
int32_t count = 0;
std::string query =
"SELECT subsId from SdmSubscriptions WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
while (row = mysql_fetch_row(res)) {
count++;
if (strcmp(row[0], std::to_string(count).c_str())) {
subsId = count;
break;
}
}
mysql_free_result(res);
//****** add query *******
query =
"insert into SdmSubscriptions set ueid='" + ueId + "'" +
",nfInstanceId='" + sdmSubscription.getNfInstanceId() + "'" +
(sdmSubscription.implicitUnsubscribeIsSet()
? (sdmSubscription.isImplicitUnsubscribe()
? ",implicitUnsubscribe=1"
: ",implicitUnsubscribe=0")
: "") +
(sdmSubscription.expiresIsSet()
? ",expires='" + sdmSubscription.getExpires() + "'"
: "") +
",callbackReference='" + sdmSubscription.getCallbackReference() + "'" +
(sdmSubscription.dnnIsSet() ? ",dnn='" + sdmSubscription.getDnn() + "'"
: "") +
(sdmSubscription.subscriptionIdIsSet()
? ",subscriptionId='" + sdmSubscription.getSubscriptionId() + "'"
: "") +
(sdmSubscription.immediateReportIsSet()
? (sdmSubscription.isImmediateReport() ? ",immediateReport=1"
: ",immediateReport=0")
: "") +
(sdmSubscription.supportedFeaturesIsSet()
? ",supportedFeatures='" + sdmSubscription.getSupportedFeatures() +
"'"
: "");
if (sdmSubscription.amfServiceNameIsSet()) {
to_json(j, sdmSubscription.getAmfServiceName());
query += ",amfServiceName='" + j.dump() + "'";
}
if (sdmSubscription.singleNssaiIsSet()) {
to_json(j, sdmSubscription.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
}
if (sdmSubscription.plmnIdIsSet()) {
to_json(j, sdmSubscription.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
}
if (sdmSubscription.reportIsSet()) {
to_json(j, sdmSubscription.getReport());
query += ",report='" + j.dump() + "'";
}
if (sdmSubscription.contextInfoIsSet()) {
to_json(j, sdmSubscription.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
nlohmann::json MonitoredResourceUris_json(
sdmSubscription.getMonitoredResourceUris());
query += ",monitoredResourceUris='" + MonitoredResourceUris_json.dump() + "'";
if (subsId && (subsId == count)) {
query += ",subsId=" + std::to_string(subsId);
}
//************************
// std::cout << query << std::endl;
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
to_json(j, sdmSubscription);
response.send(Pistache::Http::Code::Created, j.dump());
std::string out = j.dump(); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
Logger::udr_server().debug("SdmSubscriptions POST - json:\n\"%s\"", response.send(code, response_data.dump());
out.c_str());
} }
void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions( void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_query_sdm_subscriptions(ueId, response_data, code);
std::vector<std::string> fields;
nlohmann::json j, tmp;
const std::string query =
"SELECT * from SdmSubscriptions WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
while (field = mysql_fetch_field(res)) {
fields.push_back(field->name);
}
j.clear();
while (row = mysql_fetch_row(res)) {
SdmSubscription sdmsubscriptions;
tmp.clear();
for (int i = 0; i < fields.size(); i++) {
if (!strcmp("nfInstanceId", fields[i].c_str())) {
sdmsubscriptions.setNfInstanceId(row[i]);
} else if (!strcmp("implicitUnsubscribe", fields[i].c_str()) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
sdmsubscriptions.setImplicitUnsubscribe(true);
else
sdmsubscriptions.setImplicitUnsubscribe(false);
} else if (!strcmp("expires", fields[i].c_str()) && row[i] != NULL) {
sdmsubscriptions.setExpires(row[i]);
} else if (!strcmp("callbackReference", fields[i].c_str())) {
sdmsubscriptions.setCallbackReference(row[i]);
} else if (!strcmp("amfServiceName", fields[i].c_str()) &&
row[i] != NULL) {
ServiceName amfservicename;
nlohmann::json::parse(row[i]).get_to(amfservicename);
sdmsubscriptions.setAmfServiceName(amfservicename);
} else if (!strcmp("monitoredResourceUris", fields[i].c_str())) {
std::vector<std::string> monitoredresourceuris;
nlohmann::json::parse(row[i]).get_to(monitoredresourceuris);
sdmsubscriptions.setMonitoredResourceUris(monitoredresourceuris);
} else if (!strcmp("singleNssai", fields[i].c_str()) && row[i] != NULL) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
sdmsubscriptions.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", fields[i].c_str()) && row[i] != NULL) {
sdmsubscriptions.setDnn(row[i]);
} else if (!strcmp("subscriptionId", fields[i].c_str()) &&
row[i] != NULL) {
sdmsubscriptions.setSubscriptionId(row[i]);
} else if (!strcmp("plmnId", fields[i].c_str()) && row[i] != NULL) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
sdmsubscriptions.setPlmnId(plmnid);
} else if (!strcmp("immediateReport", fields[i].c_str()) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
sdmsubscriptions.setImmediateReport(true);
else
sdmsubscriptions.setImmediateReport(false);
} else if (!strcmp("report", fields[i].c_str()) && row[i] != NULL) {
SubscriptionDataSets report;
nlohmann::json::parse(row[i]).get_to(report);
sdmsubscriptions.setReport(report);
} else if (!strcmp("supportedFeatures", fields[i].c_str()) &&
row[i] != NULL) {
sdmsubscriptions.setSupportedFeatures(row[i]);
} else if (!strcmp("contextInfo", fields[i].c_str()) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
sdmsubscriptions.setContextInfo(contextinfo);
}
}
to_json(tmp, sdmsubscriptions);
j += tmp;
}
mysql_free_result(res);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump(); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
Logger::udr_server().debug("SdmSubscriptions GET - json:\n\"%s\"", response.send(code, response_data.dump());
out.c_str());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
#ifndef SDM_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef SDM_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define SDM_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #define SDM_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <SDMSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SDMSubscriptionsCollectionApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SdmSubscription.h"
#include <mysql/mysql.h>
#include "SdmSubscription.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -48,8 +44,7 @@ class SDMSubscriptionsCollectionApiImpl ...@@ -48,8 +44,7 @@ class SDMSubscriptionsCollectionApiImpl
public: public:
SDMSubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, SDMSubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address, udr_app *udr_app_inst, std::string address);
MYSQL *mysql);
~SDMSubscriptionsCollectionApiImpl() {} ~SDMSubscriptionsCollectionApiImpl() {}
void create_sdm_subscriptions(const std::string &ueId, void create_sdm_subscriptions(const std::string &ueId,
...@@ -59,9 +54,6 @@ class SDMSubscriptionsCollectionApiImpl ...@@ -59,9 +54,6 @@ class SDMSubscriptionsCollectionApiImpl
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "SMFRegistrationDocumentApiImpl.h" #include "SMFRegistrationDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -25,274 +24,45 @@ using namespace oai::udr::model; ...@@ -25,274 +24,45 @@ using namespace oai::udr::model;
SMFRegistrationDocumentApiImpl::SMFRegistrationDocumentApiImpl( SMFRegistrationDocumentApiImpl::SMFRegistrationDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: SMFRegistrationDocumentApi(rtr), : SMFRegistrationDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp( void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(
const std::string &ueId, const int32_t &pduSessionId, const std::string &ueId, const int32_t &pduSessionId,
const SmfRegistration &smfRegistration, const SmfRegistration &smfRegistration,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
m_udr_app->handle_create_smf_context_non_3gpp(
const std::string select_SmfRegistration = ueId, pduSessionId, smfRegistration, response_data, code);
"SELECT * from SmfRegistrations WHERE ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
std::string query;
nlohmann::json j;
if (mysql_real_query(mysql_WitcommUDRDB, select_SmfRegistration.c_str(),
(unsigned long)select_SmfRegistration.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_SmfRegistration.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_SmfRegistration.c_str());
return;
}
if (mysql_num_rows(res)) {
query =
"update SmfRegistrations set smfInstanceId='" +
smfRegistration.getSmfInstanceId() + "'" +
",pduSessionId=" + std::to_string(smfRegistration.getPduSessionId()) +
(smfRegistration.smfSetIdIsSet()
? ",smfSetId='" + smfRegistration.getSmfSetId() + "'"
: "") +
(smfRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" + smfRegistration.getSupportedFeatures() +
"'"
: "") +
(smfRegistration.dnnIsSet() ? ",dnn='" + smfRegistration.getDnn() + "'"
: "") +
(smfRegistration.emergencyServicesIsSet()
? (smfRegistration.isEmergencyServices() ? ",emergencyServices=1"
: ",emergencyServices=0")
: "") +
(smfRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
smfRegistration.getPcscfRestorationCallbackUri() + "'"
: "") +
(smfRegistration.pgwFqdnIsSet()
? ",pgwFqdn='" + smfRegistration.getPgwFqdn() + "'"
: "") +
(smfRegistration.epdgIndIsSet()
? (smfRegistration.isEpdgInd() ? ",epdgInd=1" : ",epdgInd=0")
: "") +
(smfRegistration.deregCallbackUriIsSet()
? ",deregCallbackUri='" + smfRegistration.getDeregCallbackUri() +
"'"
: "") +
(smfRegistration.registrationTimeIsSet()
? ",registrationTime='" + smfRegistration.getRegistrationTime() +
"'"
: "");
if (smfRegistration.registrationReasonIsSet()) {
to_json(j, smfRegistration.getRegistrationReason());
query += ",registrationReason='" + j.dump() + "'";
}
if (smfRegistration.contextInfoIsSet()) {
to_json(j, smfRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, smfRegistration.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
to_json(j, smfRegistration.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
query += " where ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
} else {
query =
"insert into SmfRegistrations set ueid='" + ueId + "'" +
",subpduSessionId=" + std::to_string(pduSessionId) +
",pduSessionId=" + std::to_string(smfRegistration.getPduSessionId()) +
",smfInstanceId='" + smfRegistration.getSmfInstanceId() + "'" +
(smfRegistration.smfSetIdIsSet()
? ",smfSetId='" + smfRegistration.getSmfSetId() + "'"
: "") +
(smfRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" + smfRegistration.getSupportedFeatures() +
"'"
: "") +
(smfRegistration.dnnIsSet() ? ",dnn='" + smfRegistration.getDnn() + "'"
: "") +
(smfRegistration.emergencyServicesIsSet()
? (smfRegistration.isEmergencyServices() ? ",emergencyServices=1"
: ",emergencyServices=0")
: "") +
(smfRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
smfRegistration.getPcscfRestorationCallbackUri() + "'"
: "") +
(smfRegistration.pgwFqdnIsSet()
? ",pgwFqdn='" + smfRegistration.getPgwFqdn() + "'"
: "") +
(smfRegistration.epdgIndIsSet()
? (smfRegistration.isEpdgInd() ? ",epdgInd=1" : ",epdgInd=0")
: "") +
(smfRegistration.deregCallbackUriIsSet()
? ",deregCallbackUri='" + smfRegistration.getDeregCallbackUri() +
"'"
: "") +
(smfRegistration.registrationTimeIsSet()
? ",registrationTime='" + smfRegistration.getRegistrationTime() +
"'"
: "");
if (smfRegistration.registrationReasonIsSet()) {
to_json(j, smfRegistration.getRegistrationReason());
query += ",registrationReason='" + j.dump() + "'";
}
if (smfRegistration.contextInfoIsSet()) {
to_json(j, smfRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, smfRegistration.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
to_json(j, smfRegistration.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
}
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
// std::cout << query << std::endl; response.send(code, response_data.dump());
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
to_json(j, smfRegistration);
response.send(Pistache::Http::Code::Created, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("SmfRegistration PUT - json:\n\"%s\"",
out.c_str());
} }
void SMFRegistrationDocumentApiImpl::delete_smf_context( void SMFRegistrationDocumentApiImpl::delete_smf_context(
const std::string &ueId, const int32_t &pduSessionId, const std::string &ueId, const int32_t &pduSessionId,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
const std::string query = nlohmann::json response_data = {};
"DELETE from SmfRegistrations WHERE ueid='" + ueId + Pistache::Http::Code code = {};
"' AND subpduSessionId=" + std::to_string(pduSessionId); m_udr_app->handle_delete_smf_context(ueId, pduSessionId, response_data, code);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
response.send(Pistache::Http::Code::No_Content, ""); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
Logger::udr_server().debug("SmfRegistration DELETE - successful"); response.send(code, response_data.dump());
} }
void SMFRegistrationDocumentApiImpl::query_smf_registration( void SMFRegistrationDocumentApiImpl::query_smf_registration(
const std::string &ueId, const int32_t &pduSessionId, const std::string &ueId, const int32_t &pduSessionId,
const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_query_smf_registration(ueId, pduSessionId, response_data,
code);
nlohmann::json j;
SmfRegistration smfregistration;
const std::string query =
"SELECT * from SmfRegistrations WHERE ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("smfInstanceId", field->name)) {
smfregistration.setSmfInstanceId(row[i]);
} else if (!strcmp("smfSetId", field->name) && row[i] != NULL) {
smfregistration.setSmfSetId(row[i]);
} else if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
smfregistration.setSupportedFeatures(row[i]);
} else if (!strcmp("pduSessionId", field->name)) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
smfregistration.setPduSessionId(a);
} else if (!strcmp("singleNssai", field->name)) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
smfregistration.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", field->name) && row[i] != NULL) {
smfregistration.setDnn(row[i]);
} else if (!strcmp("emergencyServices", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEmergencyServices(true);
else
smfregistration.setEmergencyServices(false);
} else if (!strcmp("pcscfRestorationCallbackUri", field->name) &&
row[i] != NULL) {
smfregistration.setPcscfRestorationCallbackUri(row[i]);
} else if (!strcmp("plmnId", field->name)) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
smfregistration.setPlmnId(plmnid);
} else if (!strcmp("pgwFqdn", field->name) && row[i] != NULL) {
smfregistration.setPgwFqdn(row[i]);
} else if (!strcmp("epdgInd", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEpdgInd(true);
else
smfregistration.setEpdgInd(false);
} else if (!strcmp("deregCallbackUri", field->name) && row[i] != NULL) {
smfregistration.setDeregCallbackUri(row[i]);
} else if (!strcmp("registrationReason", field->name) && row[i] != NULL) {
RegistrationReason registrationreason;
nlohmann::json::parse(row[i]).get_to(registrationreason);
smfregistration.setRegistrationReason(registrationreason);
} else if (!strcmp("registrationTime", field->name) && row[i] != NULL) {
smfregistration.setRegistrationTime(row[i]);
} else if (!strcmp("contextInfo", field->name) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
smfregistration.setContextInfo(contextinfo);
}
}
to_json(j, smfregistration);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("SmfRegistration GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("SmfRegistration no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
#ifndef SMF_REGISTRATION_DOCUMENT_API_IMPL_H_ #ifndef SMF_REGISTRATION_DOCUMENT_API_IMPL_H_
#define SMF_REGISTRATION_DOCUMENT_API_IMPL_H_ #define SMF_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <SMFRegistrationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMFRegistrationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmfRegistration.h"
#include <mysql/mysql.h>
#include "SmfRegistration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -48,8 +44,7 @@ class SMFRegistrationDocumentApiImpl ...@@ -48,8 +44,7 @@ class SMFRegistrationDocumentApiImpl
public: public:
SMFRegistrationDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, SMFRegistrationDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address, udr_app *udr_app_inst, std::string address);
MYSQL *mysql);
~SMFRegistrationDocumentApiImpl() {} ~SMFRegistrationDocumentApiImpl() {}
void create_smf_context_non3gpp(const std::string &ueId, void create_smf_context_non3gpp(const std::string &ueId,
...@@ -63,9 +58,6 @@ class SMFRegistrationDocumentApiImpl ...@@ -63,9 +58,6 @@ class SMFRegistrationDocumentApiImpl
const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "SMFRegistrationsCollectionApiImpl.h" #include "SMFRegistrationsCollectionApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -25,121 +24,21 @@ using namespace oai::udr::model; ...@@ -25,121 +24,21 @@ using namespace oai::udr::model;
SMFRegistrationsCollectionApiImpl::SMFRegistrationsCollectionApiImpl( SMFRegistrationsCollectionApiImpl::SMFRegistrationsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: SMFRegistrationsCollectionApi(rtr), : SMFRegistrationsCollectionApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void SMFRegistrationsCollectionApiImpl::query_smf_reg_list( void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_query_smf_reg_list(ueId, response_data, code);
std::vector<std::string> fields;
nlohmann::json j, tmp;
const std::string query =
"SELECT * from SmfRegistrations WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
while (field = mysql_fetch_field(res)) {
fields.push_back(field->name);
}
j.clear();
while (row = mysql_fetch_row(res)) {
SmfRegistration smfregistration;
tmp.clear();
for (int i = 0; i < fields.size(); i++) {
if (!strcmp("smfInstanceId", fields[i].c_str())) {
smfregistration.setSmfInstanceId(row[i]);
} else if (!strcmp("smfSetId", fields[i].c_str()) && row[i] != NULL) {
smfregistration.setSmfSetId(row[i]);
} else if (!strcmp("supportedFeatures", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setSupportedFeatures(row[i]);
} else if (!strcmp("pduSessionId", fields[i].c_str())) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
smfregistration.setPduSessionId(a);
} else if (!strcmp("singleNssai", fields[i].c_str())) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
smfregistration.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", fields[i].c_str()) && row[i] != NULL) {
smfregistration.setDnn(row[i]);
} else if (!strcmp("emergencyServices", fields[i].c_str()) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEmergencyServices(true);
else
smfregistration.setEmergencyServices(false);
} else if (!strcmp("pcscfRestorationCallbackUri", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setPcscfRestorationCallbackUri(row[i]);
} else if (!strcmp("plmnId", fields[i].c_str())) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
smfregistration.setPlmnId(plmnid);
} else if (!strcmp("pgwFqdn", fields[i].c_str()) && row[i] != NULL) {
smfregistration.setPgwFqdn(row[i]);
} else if (!strcmp("epdgInd", fields[i].c_str()) && row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEpdgInd(true);
else
smfregistration.setEpdgInd(false);
} else if (!strcmp("deregCallbackUri", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setDeregCallbackUri(row[i]);
} else if (!strcmp("registrationReason", fields[i].c_str()) &&
row[i] != NULL) {
RegistrationReason registrationreason;
nlohmann::json::parse(row[i]).get_to(registrationreason);
smfregistration.setRegistrationReason(registrationreason);
} else if (!strcmp("registrationTime", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setRegistrationTime(row[i]);
} else if (!strcmp("contextInfo", fields[i].c_str()) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
smfregistration.setContextInfo(contextinfo);
}
}
to_json(tmp, smfregistration);
j += tmp;
}
mysql_free_result(res);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump(); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
Logger::udr_server().debug("SmfRegistrations GET - json:\n\"%s\"", response.send(code, response_data.dump());
out.c_str());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
#ifndef SMF_REGISTRATIONS_COLLECTION_API_IMPL_H_ #ifndef SMF_REGISTRATIONS_COLLECTION_API_IMPL_H_
#define SMF_REGISTRATIONS_COLLECTION_API_IMPL_H_ #define SMF_REGISTRATIONS_COLLECTION_API_IMPL_H_
#include <SMFRegistrationsCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMFRegistrationsCollectionApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmfRegistration.h"
#include <mysql/mysql.h>
#include "SmfRegistration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -48,17 +44,13 @@ class SMFRegistrationsCollectionApiImpl ...@@ -48,17 +44,13 @@ class SMFRegistrationsCollectionApiImpl
public: public:
SMFRegistrationsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, SMFRegistrationsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address, udr_app *udr_app_inst, std::string address);
MYSQL *mysql);
~SMFRegistrationsCollectionApiImpl() {} ~SMFRegistrationsCollectionApiImpl() {}
void query_smf_reg_list( void query_smf_reg_list(
const std::string &ueId, const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "SMFSelectionSubscriptionDataDocumentApiImpl.h" #include "SMFSelectionSubscriptionDataDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -26,12 +25,10 @@ using namespace oai::udr::model; ...@@ -26,12 +25,10 @@ using namespace oai::udr::model;
SMFSelectionSubscriptionDataDocumentApiImpl:: SMFSelectionSubscriptionDataDocumentApiImpl::
SMFSelectionSubscriptionDataDocumentApiImpl( SMFSelectionSubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: SMFSelectionSubscriptionDataDocumentApi(rtr), : SMFSelectionSubscriptionDataDocumentApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data( void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(
const std::string &ueId, const std::string &servingPlmnId, const std::string &ueId, const std::string &servingPlmnId,
...@@ -40,60 +37,13 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data( ...@@ -40,60 +37,13 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch, const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince, const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL; nlohmann::json response_data = {};
MYSQL_ROW row; Pistache::Http::Code code = {};
MYSQL_FIELD *field = nullptr; m_udr_app->handle_query_smf_select_data(ueId, servingPlmnId, response_data,
code);
nlohmann::json j;
SmfSelectionSubscriptionData smfselectionsubscriptiondata;
const std::string query =
"select * from SmfSelectionSubscriptionData WHERE ueid='" + ueId +
"' and servingPlmnid='" + servingPlmnId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
smfselectionsubscriptiondata.setSupportedFeatures(row[i]);
} else if (!strcmp("subscribedSnssaiInfos", field->name) &&
row[i] != NULL) {
std ::map<std ::string, SnssaiInfo> subscribedsnssaiinfos;
nlohmann::json::parse(row[i]).get_to(subscribedsnssaiinfos);
smfselectionsubscriptiondata.setSubscribedSnssaiInfos(
subscribedsnssaiinfos);
} else if (!strcmp("sharedSnssaiInfosId", field->name) &&
row[i] != NULL) {
smfselectionsubscriptiondata.setSharedSnssaiInfosId(row[i]);
}
}
to_json(j, smfselectionsubscriptiondata);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug(
"SmfSelectionSubscriptionData GET - json:\n\"%s\"", out.c_str());
} else {
Logger::udr_server().error("SmfSelectionSubscriptionData no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
#ifndef SMF_SELECTION_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #ifndef SMF_SELECTION_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#define SMF_SELECTION_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #define SMF_SELECTION_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#include <SMFSelectionSubscriptionDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMFSelectionSubscriptionDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmfSelectionSubscriptionData.h"
#include <mysql/mysql.h>
#include "SmfSelectionSubscriptionData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -49,7 +45,7 @@ class SMFSelectionSubscriptionDataDocumentApiImpl ...@@ -49,7 +45,7 @@ class SMFSelectionSubscriptionDataDocumentApiImpl
public: public:
SMFSelectionSubscriptionDataDocumentApiImpl( SMFSelectionSubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql); std::string address);
~SMFSelectionSubscriptionDataDocumentApiImpl() {} ~SMFSelectionSubscriptionDataDocumentApiImpl() {}
void query_smf_select_data( void query_smf_select_data(
...@@ -59,9 +55,6 @@ class SMFSelectionSubscriptionDataDocumentApiImpl ...@@ -59,9 +55,6 @@ class SMFSelectionSubscriptionDataDocumentApiImpl
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch, const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince, const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef SMSF3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_ #ifndef SMSF3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_
#define SMSF3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_ #define SMSF3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <SMSF3GPPRegistrationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSF3GPPRegistrationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmsfRegistration.h"
#include "SmsfRegistration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef SMSF_NON3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_ #ifndef SMSF_NON3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_
#define SMSF_NON3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_ #define SMSF_NON3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <SMSFNon3GPPRegistrationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSFNon3GPPRegistrationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmsfRegistration.h"
#include "SmsfRegistration.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef SMS_MANAGEMENT_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #ifndef SMS_MANAGEMENT_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#define SMS_MANAGEMENT_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #define SMS_MANAGEMENT_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#include <SMSManagementSubscriptionDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSManagementSubscriptionDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmsManagementSubscriptionData.h"
#include "SmsManagementSubscriptionData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef SMS_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #ifndef SMS_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#define SMS_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_ #define SMS_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#include <SMSSubscriptionDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSSubscriptionDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SmsSubscriptionData.h"
#include "SmsSubscriptionData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,21 +20,19 @@ ...@@ -20,21 +20,19 @@
#ifndef SESSION_MANAGEMENT_POLICY_DATA_DOCUMENT_API_IMPL_H_ #ifndef SESSION_MANAGEMENT_POLICY_DATA_DOCUMENT_API_IMPL_H_
#define SESSION_MANAGEMENT_POLICY_DATA_DOCUMENT_API_IMPL_H_ #define SESSION_MANAGEMENT_POLICY_DATA_DOCUMENT_API_IMPL_H_
#include <SessionManagementPolicyDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SessionManagementPolicyDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "SmPolicyData.h" #include "SmPolicyData.h"
#include "SmPolicyDataPatch.h" #include "SmPolicyDataPatch.h"
#include "Snssai.h" #include "Snssai.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "SessionManagementSubscriptionDataApiImpl.h" #include "SessionManagementSubscriptionDataApiImpl.h"
#include "logger.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr_app.hpp" #include "udr_app.hpp"
...@@ -26,12 +25,10 @@ using namespace oai::udr::model; ...@@ -26,12 +25,10 @@ using namespace oai::udr::model;
SessionManagementSubscriptionDataApiImpl:: SessionManagementSubscriptionDataApiImpl::
SessionManagementSubscriptionDataApiImpl( SessionManagementSubscriptionDataApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql) std::string address)
: SessionManagementSubscriptionDataApi(rtr), : SessionManagementSubscriptionDataApi(rtr),
m_udr_app(udr_app_inst), m_udr_app(udr_app_inst),
m_address(address) { m_address(address) {}
mysql_WitcommUDRDB = mysql;
}
void SessionManagementSubscriptionDataApiImpl::query_sm_data( void SessionManagementSubscriptionDataApiImpl::query_sm_data(
const std::string &ueId, const std::string &servingPlmnId, const std::string &ueId, const std::string &servingPlmnId,
...@@ -44,99 +41,22 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data( ...@@ -44,99 +41,22 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter &response) {
// response.send(Pistache::Http::Code::Ok, "query_sm_data\n"); // response.send(Pistache::Http::Code::Ok, "query_sm_data\n");
// servingPlmnId pattern: "^[0-9]{5,6}$" // servingPlmnId pattern: "^[0-9]{5,6}$"
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
SessionManagementSubscriptionData sessionmanagementsubscriptiondata;
const std::string query =
"select * from SessionManagementSubscriptionData WHERE ueid='" + ueId +
"' and servingPlmnid='" + servingPlmnId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(mysql_WitcommUDRDB); Snssai snssai = {};
if (res == NULL) { if (!singleNssai.isEmpty()) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)", snssai = singleNssai.get();
query.c_str());
return;
} }
std::string dnn_str = {};
row = mysql_fetch_row(res); if (!dnn.isEmpty()) {
dnn_str = dnn.get();
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("singleNssai", field->name)) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
sessionmanagementsubscriptiondata.setSingleNssai(singlenssai);
} else if (!strcmp("dnnConfigurations", field->name) && row[i] != NULL) {
std ::map<std ::string, DnnConfiguration> dnnconfigurations;
nlohmann::json::parse(row[i]).get_to(dnnconfigurations);
sessionmanagementsubscriptiondata.setDnnConfigurations(
dnnconfigurations);
} else if (!strcmp("internalGroupIds", field->name) && row[i] != NULL) {
std ::vector<std ::string> internalgroupIds;
nlohmann::json::parse(row[i]).get_to(internalgroupIds);
sessionmanagementsubscriptiondata.setInternalGroupIds(internalgroupIds);
} else if (!strcmp("sharedVnGroupDataIds", field->name) &&
row[i] != NULL) {
std ::map<std ::string, std ::string> sharedvngroupdataids;
nlohmann::json::parse(row[i]).get_to(sharedvngroupdataids);
sessionmanagementsubscriptiondata.setSharedVnGroupDataIds(
sharedvngroupdataids);
} else if (!strcmp("sharedDnnConfigurationsId", field->name) &&
row[i] != NULL) {
sessionmanagementsubscriptiondata.setSharedDnnConfigurationsId(row[i]);
} else if (!strcmp("odbPacketServices", field->name) && row[i] != NULL) {
OdbPacketServices odbpacketservices;
nlohmann::json::parse(row[i]).get_to(odbpacketservices);
sessionmanagementsubscriptiondata.setOdbPacketServices(
odbpacketservices);
} else if (!strcmp("traceData", field->name) && row[i] != NULL) {
TraceData tracedata;
nlohmann::json::parse(row[i]).get_to(tracedata);
sessionmanagementsubscriptiondata.setTraceData(tracedata);
} else if (!strcmp("sharedTraceDataId", field->name) && row[i] != NULL) {
sessionmanagementsubscriptiondata.setSharedTraceDataId(row[i]);
} else if (!strcmp("expectedUeBehavioursList", field->name) &&
row[i] != NULL) {
std ::map<std ::string, ExpectedUeBehaviourData>
expecteduebehaviourslist;
nlohmann::json::parse(row[i]).get_to(expecteduebehaviourslist);
sessionmanagementsubscriptiondata.setExpectedUeBehavioursList(
expecteduebehaviourslist);
} else if (!strcmp("suggestedPacketNumDlList", field->name) &&
row[i] != NULL) {
std ::map<std ::string, SuggestedPacketNumDl> suggestedpacketnumdllist;
nlohmann::json::parse(row[i]).get_to(suggestedpacketnumdllist);
sessionmanagementsubscriptiondata.setSuggestedPacketNumDlList(
suggestedpacketnumdllist);
} else if (!strcmp("3gppChargingCharacteristics", field->name) &&
row[i] != NULL) {
sessionmanagementsubscriptiondata.setR3gppChargingCharacteristics(
row[i]);
}
}
to_json(j, sessionmanagementsubscriptiondata);
response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug(
"SessionManagementSubscriptionData GET - json:\n\"%s\"", out.c_str());
} else {
Logger::udr_server().error(
"SessionManagementSubscriptionData no data!SQL(%s)", query.c_str());
} }
// TODO: DNN and SNSSAI
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_sm_data(ueId, servingPlmnId, response_data, code);
mysql_free_result(res); Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
} }
} // namespace oai::udr::api } // namespace oai::udr::api
...@@ -20,21 +20,17 @@ ...@@ -20,21 +20,17 @@
#ifndef SESSION_MANAGEMENT_SUBSCRIPTION_DATA_API_IMPL_H_ #ifndef SESSION_MANAGEMENT_SUBSCRIPTION_DATA_API_IMPL_H_
#define SESSION_MANAGEMENT_SUBSCRIPTION_DATA_API_IMPL_H_ #define SESSION_MANAGEMENT_SUBSCRIPTION_DATA_API_IMPL_H_
#include <SessionManagementSubscriptionDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SessionManagementSubscriptionDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SessionManagementSubscriptionData.h" #include "SessionManagementSubscriptionData.h"
#include "Snssai.h" #include "Snssai.h"
#include <mysql/mysql.h>
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
...@@ -50,7 +46,7 @@ class SessionManagementSubscriptionDataApiImpl ...@@ -50,7 +46,7 @@ class SessionManagementSubscriptionDataApiImpl
public: public:
SessionManagementSubscriptionDataApiImpl( SessionManagementSubscriptionDataApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst, std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql); std::string address);
~SessionManagementSubscriptionDataApiImpl() {} ~SessionManagementSubscriptionDataApiImpl() {}
void query_sm_data( void query_sm_data(
...@@ -62,9 +58,6 @@ class SessionManagementSubscriptionDataApiImpl ...@@ -62,9 +58,6 @@ class SessionManagementSubscriptionDataApiImpl
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch, const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince, const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
}; };
} // namespace oai::udr::api } // namespace oai::udr::api
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef SPONSOR_CONNECTIVITY_DATA_DOCUMENT_API_IMPL_H_ #ifndef SPONSOR_CONNECTIVITY_DATA_DOCUMENT_API_IMPL_H_
#define SPONSOR_CONNECTIVITY_DATA_DOCUMENT_API_IMPL_H_ #define SPONSOR_CONNECTIVITY_DATA_DOCUMENT_API_IMPL_H_
#include <SponsorConnectivityDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SponsorConnectivityDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "SponsorConnectivityData.h" #include "SponsorConnectivityData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef SUBS_TO_NOTIFY_COLLECTION_API_IMPL_H_ #ifndef SUBS_TO_NOTIFY_COLLECTION_API_IMPL_H_
#define SUBS_TO_NOTIFY_COLLECTION_API_IMPL_H_ #define SUBS_TO_NOTIFY_COLLECTION_API_IMPL_H_
#include <SubsToNotifyCollectionApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SubsToNotifyCollectionApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "SubscriptionDataSubscriptions.h"
#include "SubscriptionDataSubscriptions.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,22 +20,21 @@ ...@@ -20,22 +20,21 @@
#ifndef SUBS_TO_NOTIFY_DOCUMENT_API_IMPL_H_ #ifndef SUBS_TO_NOTIFY_DOCUMENT_API_IMPL_H_
#define SUBS_TO_NOTIFY_DOCUMENT_API_IMPL_H_ #define SUBS_TO_NOTIFY_DOCUMENT_API_IMPL_H_
#include <SubsToNotifyDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h> #include <pistache/router.h>
#include <memory>
#include <SubsToNotifyDocumentApi.h>
#include <pistache/optional.h> #include <memory>
//#include "Object.h" //#include "Object.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include "PatchItem.h" #include "PatchItem.h"
#include "PatchResult.h" #include "PatchResult.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef TRACE_DATA_DOCUMENT_API_IMPL_H_ #ifndef TRACE_DATA_DOCUMENT_API_IMPL_H_
#define TRACE_DATA_DOCUMENT_API_IMPL_H_ #define TRACE_DATA_DOCUMENT_API_IMPL_H_
#include <TraceDataDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <TraceDataDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "TraceData.h"
#include "TraceData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,20 +20,18 @@ ...@@ -20,20 +20,18 @@
#ifndef UE_POLICY_SET_DOCUMENT_API_IMPL_H_ #ifndef UE_POLICY_SET_DOCUMENT_API_IMPL_H_
#define UE_POLICY_SET_DOCUMENT_API_IMPL_H_ #define UE_POLICY_SET_DOCUMENT_API_IMPL_H_
#include <UEPolicySetDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <UEPolicySetDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "UePolicySet.h" #include "UePolicySet.h"
#include "UePolicySetPatch.h" #include "UePolicySetPatch.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef U_ES_LOCATION_INFORMATION_DOCUMENT_API_IMPL_H_ #ifndef U_ES_LOCATION_INFORMATION_DOCUMENT_API_IMPL_H_
#define U_ES_LOCATION_INFORMATION_DOCUMENT_API_IMPL_H_ #define U_ES_LOCATION_INFORMATION_DOCUMENT_API_IMPL_H_
#include <UEsLocationInformationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <UEsLocationInformationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "LocationInfo.h"
#include "LocationInfo.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,19 +20,17 @@ ...@@ -20,19 +20,17 @@
#ifndef USAGE_MONITORING_INFORMATION_DOCUMENT_API_IMPL_H_ #ifndef USAGE_MONITORING_INFORMATION_DOCUMENT_API_IMPL_H_
#define USAGE_MONITORING_INFORMATION_DOCUMENT_API_IMPL_H_ #define USAGE_MONITORING_INFORMATION_DOCUMENT_API_IMPL_H_
#include <UsageMonitoringInformationDocumentApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <UsageMonitoringInformationDocumentApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "UsageMonData.h" #include "UsageMonData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -20,18 +20,16 @@ ...@@ -20,18 +20,16 @@
#ifndef V2_X_SUBSCRIPTION_DATA_API_IMPL_H_ #ifndef V2_X_SUBSCRIPTION_DATA_API_IMPL_H_
#define V2_X_SUBSCRIPTION_DATA_API_IMPL_H_ #define V2_X_SUBSCRIPTION_DATA_API_IMPL_H_
#include <V2XSubscriptionDataApi.h>
#include <pistache/endpoint.h> #include <pistache/endpoint.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <V2XSubscriptionDataApi.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string> #include <string>
#include "V2xSubscriptionData.h"
#include "V2xSubscriptionData.h"
#include "udr_app.hpp" #include "udr_app.hpp"
namespace oai::udr::api { namespace oai::udr::api {
......
...@@ -82,8 +82,8 @@ void UDRApiServer::init(size_t thr) { ...@@ -82,8 +82,8 @@ void UDRApiServer::init(size_t thr) {
auto opts = Pistache::Http::Endpoint::options().threads(thr); auto opts = Pistache::Http::Endpoint::options().threads(thr);
opts.flags(Pistache::Tcp::Options::ReuseAddr); opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxRequestSize(PISTACHE_SERVER_MAX_PAYLOAD); opts.maxRequestSize(PISTACHE_SERVER_MAX_PAYLOAD);
// opts.maxRequestSize(PISTACHE_SERVER_MAX_REQUEST_SIZE); // opts.maxRequestSize(PISTACHE_SERVER_MAX_REQUEST_SIZE);
// opts.maxResponseSize(PISTACHE_SERVER_MAX_RESPONSE_SIZE); // opts.maxResponseSize(PISTACHE_SERVER_MAX_RESPONSE_SIZE);
m_httpEndpoint->init(opts); m_httpEndpoint->init(opts);
m_authenticationSubscriptionDocumentApiserver->init(); m_authenticationSubscriptionDocumentApiserver->init();
...@@ -106,6 +106,4 @@ void UDRApiServer::start() { ...@@ -106,6 +106,4 @@ void UDRApiServer::start() {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UDRApiServer::shutdown() { void UDRApiServer::shutdown() { m_httpEndpoint->shutdown(); }
m_httpEndpoint->shutdown();
}
...@@ -70,32 +70,35 @@ class UDRApiServer { ...@@ -70,32 +70,35 @@ class UDRApiServer {
m_address = address.host() + ":" + (address.port()).toString(); m_address = address.host() + ":" + (address.port()).toString();
m_authenticationSubscriptionDocumentApiserver = m_authenticationSubscriptionDocumentApiserver =
std::make_shared<AuthenticationSubscriptionDocumentApiImpl>(m_router, udr_app_inst, m_address); std::make_shared<AuthenticationSubscriptionDocumentApiImpl>(
m_router, udr_app_inst, m_address);
m_authenticationStatusDocumentApiserver = m_authenticationStatusDocumentApiserver =
std::make_shared<AuthenticationStatusDocumentApiImpl>(m_router, udr_app_inst, m_address); std::make_shared<AuthenticationStatusDocumentApiImpl>(
m_router, udr_app_inst, m_address);
m_accessAndMobilitySubscriptionDataDocumentApiserver = m_accessAndMobilitySubscriptionDataDocumentApiserver =
std::make_shared<AccessAndMobilitySubscriptionDataDocumentApiImpl>( std::make_shared<AccessAndMobilitySubscriptionDataDocumentApiImpl>(
m_router, udr_app_inst, m_address); m_router, udr_app_inst, m_address);
m_sMFSelectionSubscriptionDataDocumentApiserver = m_sMFSelectionSubscriptionDataDocumentApiserver =
std::make_shared<SMFSelectionSubscriptionDataDocumentApiImpl>(m_router, std::make_shared<SMFSelectionSubscriptionDataDocumentApiImpl>(
udr_app_inst, m_address); m_router, udr_app_inst, m_address);
m_sessionManagementSubscriptionDataApiserver = m_sessionManagementSubscriptionDataApiserver =
std::make_shared<SessionManagementSubscriptionDataApiImpl>(m_router, std::make_shared<SessionManagementSubscriptionDataApiImpl>(
udr_app_inst, m_address); m_router, udr_app_inst, m_address);
m_aMF3GPPAccessRegistrationDocumentApiserver = m_aMF3GPPAccessRegistrationDocumentApiserver =
std::make_shared<AMF3GPPAccessRegistrationDocumentApiImpl>(m_router, std::make_shared<AMF3GPPAccessRegistrationDocumentApiImpl>(
udr_app_inst, m_address); m_router, udr_app_inst, m_address);
m_sMFRegistrationDocumentApiserver = m_sMFRegistrationDocumentApiserver =
std::make_shared<SMFRegistrationDocumentApiImpl>(m_router, udr_app_inst, m_address); std::make_shared<SMFRegistrationDocumentApiImpl>(m_router, udr_app_inst,
m_address);
m_sMFRegistrationsCollectionApiserver = m_sMFRegistrationsCollectionApiserver =
std::make_shared<SMFRegistrationsCollectionApiImpl>(m_router, udr_app_inst, m_address); std::make_shared<SMFRegistrationsCollectionApiImpl>(
m_router, udr_app_inst, m_address);
m_sDMSubscriptionDocumentApiserver = m_sDMSubscriptionDocumentApiserver =
std::make_shared<SDMSubscriptionDocumentApiImpl>(m_router, udr_app_inst, m_address); std::make_shared<SDMSubscriptionDocumentApiImpl>(m_router, udr_app_inst,
m_address);
m_sDMSubscriptionsCollectionApiserver = m_sDMSubscriptionsCollectionApiserver =
std::make_shared<SDMSubscriptionsCollectionApiImpl>(m_router, udr_app_inst, m_address); std::make_shared<SDMSubscriptionsCollectionApiImpl>(
m_router, udr_app_inst, m_address);
} }
void init(size_t thr = 1); void init(size_t thr = 1);
void start(); void start();
......
...@@ -290,5 +290,5 @@ IF(STATIC_LINKING) ...@@ -290,5 +290,5 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING) ENDIF(STATIC_LINKING)
target_link_libraries (udr ${ASAN} target_link_libraries (udr ${ASAN}
-Wl,--start-group UDR 3GPP_COMMON_TYPES 5GAKA UDR_API CN_UTILS -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lboost_system -lboost_thread -lboost_date_time -lssl -lcrypto -lgmp -Wl,--end-group pthread m rt config++ boost_system pistache curl) -Wl,--start-group UDR 3GPP_COMMON_TYPES UDR_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lboost_system -lboost_thread -lboost_date_time -lssl -lcrypto -lgmp -lmysqlclient -Wl,--end-group pthread m rt config++ boost_system pistache curl)
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*/ */
#include "udr_app.hpp" #include "udr_app.hpp"
#include <mysql/mysql.h>
#include <unistd.h> #include <unistd.h>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
...@@ -40,34 +40,2047 @@ ...@@ -40,34 +40,2047 @@
#include <boost/uuid/uuid_io.hpp> #include <boost/uuid/uuid_io.hpp>
#include <chrono> #include <chrono>
#include "AccessAndMobilitySubscriptionData.h"
#include "AuthenticationSubscription.h"
#include "ProblemDetails.h"
#include "SequenceNumber.h"
#include "logger.hpp" #include "logger.hpp"
#include "udr_config.hpp" #include "udr_config.hpp"
using namespace oai::udr::app; using namespace oai::udr::app;
using namespace oai::udr::model;
using namespace std::chrono; using namespace std::chrono;
using namespace config; using namespace config;
extern udr_app* udr_app_inst; extern udr_app *udr_app_inst;
extern udr_config udr_cfg; extern udr_config udr_cfg;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
udr_app::udr_app(const std::string& config_file) { udr_app::udr_app(const std::string &config_file) {
Logger::udr_app().startup("Starting..."); Logger::udr_app().startup("Starting...");
mysql_init(&mysql);
if (!mysql_real_connect(&mysql, udr_cfg.mysql.mysql_server.c_str(),
udr_cfg.mysql.mysql_user.c_str(),
udr_cfg.mysql.mysql_pass.c_str(),
udr_cfg.mysql.mysql_db.c_str(), 0, 0, 0)) {
Logger::udr_app().error("An error occurred while connecting to db: %s",
mysql_error(&mysql));
}
// TODO: Register to NRF // TODO: Register to NRF
Logger::udr_app().startup("Started"); Logger::udr_app().startup("Started");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
udr_app::~udr_app() { udr_app::~udr_app() { Logger::udr_app().debug("Delete UDM APP instance..."); }
Logger::udr_app().debug("Delete UDM APP instance...");
}
//------------------------------------------------------------------------------
void udr_app::handle_access_mobility_subscription_data_document( void udr_app::handle_access_mobility_subscription_data_document(
const std::string &ue_id, const std::string &serving_plmn_id, nlohmann::json& response_data, const std::string &ue_id, const std::string &serving_plmn_id,
Pistache::Http::Code& code) nlohmann::json &response_data, Pistache::Http::Code &code) {
{ MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
oai::udr::model::AccessAndMobilitySubscriptionData
accessandmobilitysubscriptiondata;
const std::string query =
"select * from AccessAndMobilitySubscriptionData WHERE ueid='" + ue_id +
"' and servingPlmnid='" + serving_plmn_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!");
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!");
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
accessandmobilitysubscriptiondata.setSupportedFeatures(row[i]);
} else if (!strcmp("gpsis", field->name) && row[i] != NULL) {
std::vector<std ::string> gpsis;
nlohmann::json::parse(row[i]).get_to(gpsis);
accessandmobilitysubscriptiondata.setGpsis(gpsis);
} else if (!strcmp("internalGroupIds", field->name) && row[i] != NULL) {
std::vector<std ::string> internalgroupids;
nlohmann::json::parse(row[i]).get_to(internalgroupids);
accessandmobilitysubscriptiondata.setInternalGroupIds(internalgroupids);
} else if (!strcmp("sharedVnGroupDataIds", field->name) &&
row[i] != NULL) {
std::map<std ::string, std::string> sharedvngroupdataids;
nlohmann::json::parse(row[i]).get_to(sharedvngroupdataids);
accessandmobilitysubscriptiondata.setSharedVnGroupDataIds(
sharedvngroupdataids);
} else if (!strcmp("subscribedUeAmbr", field->name) && row[i] != NULL) {
AmbrRm subscribedueambr;
nlohmann::json::parse(row[i]).get_to(subscribedueambr);
accessandmobilitysubscriptiondata.setSubscribedUeAmbr(subscribedueambr);
} else if (!strcmp("nssai", field->name) && row[i] != NULL) {
Nssai nssai;
nlohmann::json::parse(row[i]).get_to(nssai);
accessandmobilitysubscriptiondata.setNssai(nssai);
} else if (!strcmp("ratRestrictions", field->name) && row[i] != NULL) {
std ::vector<RatType> ratrestrictions;
nlohmann::json::parse(row[i]).get_to(ratrestrictions);
accessandmobilitysubscriptiondata.setRatRestrictions(ratrestrictions);
} else if (!strcmp("forbiddenAreas", field->name) && row[i] != NULL) {
std ::vector<Area> forbiddenareas;
nlohmann::json::parse(row[i]).get_to(forbiddenareas);
accessandmobilitysubscriptiondata.setForbiddenAreas(forbiddenareas);
} else if (!strcmp("serviceAreaRestriction", field->name) &&
row[i] != NULL) {
ServiceAreaRestriction servicearearestriction;
nlohmann::json::parse(row[i]).get_to(servicearearestriction);
accessandmobilitysubscriptiondata.setServiceAreaRestriction(
servicearearestriction);
} else if (!strcmp("coreNetworkTypeRestrictions", field->name) &&
row[i] != NULL) {
std ::vector<CoreNetworkType> corenetworktyperestrictions;
nlohmann::json::parse(row[i]).get_to(corenetworktyperestrictions);
accessandmobilitysubscriptiondata.setCoreNetworkTypeRestrictions(
corenetworktyperestrictions);
} else if (!strcmp("rfspIndex", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setRfspIndex(a);
} else if (!strcmp("subsRegTimer", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setSubsRegTimer(a);
} else if (!strcmp("ueUsageType", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setUeUsageType(a);
} else if (!strcmp("mpsPriority", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setMpsPriority(true);
else
accessandmobilitysubscriptiondata.setMpsPriority(false);
} else if (!strcmp("mcsPriority", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setMcsPriority(true);
else
accessandmobilitysubscriptiondata.setMcsPriority(false);
} else if (!strcmp("activeTime", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setActiveTime(a);
} else if (!strcmp("sorInfo", field->name) && row[i] != NULL) {
SorInfo sorinfo;
nlohmann::json::parse(row[i]).get_to(sorinfo);
accessandmobilitysubscriptiondata.setSorInfo(sorinfo);
} else if (!strcmp("sorInfoExpectInd", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setSorInfoExpectInd(true);
else
accessandmobilitysubscriptiondata.setSorInfoExpectInd(false);
} else if (!strcmp("sorafRetrieval", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setSorafRetrieval(true);
else
accessandmobilitysubscriptiondata.setSorafRetrieval(false);
} else if (!strcmp("sorUpdateIndicatorList", field->name) &&
row[i] != NULL) {
std ::vector<SorUpdateIndicator> sorupdateindicatorlist;
nlohmann::json::parse(row[i]).get_to(sorupdateindicatorlist);
accessandmobilitysubscriptiondata.setSorUpdateIndicatorList(
sorupdateindicatorlist);
} else if (!strcmp("upuInfo", field->name) && row[i] != NULL) {
UpuInfo upuinfo;
nlohmann::json::parse(row[i]).get_to(upuinfo);
accessandmobilitysubscriptiondata.setUpuInfo(upuinfo);
} else if (!strcmp("micoAllowed", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setMicoAllowed(true);
else
accessandmobilitysubscriptiondata.setMicoAllowed(false);
} else if (!strcmp("sharedAmDataIds", field->name) && row[i] != NULL) {
std ::vector<std ::string> sharedamdataids;
nlohmann::json::parse(row[i]).get_to(sharedamdataids);
accessandmobilitysubscriptiondata.setSharedAmDataIds(sharedamdataids);
} else if (!strcmp("odbPacketServices", field->name) && row[i] != NULL) {
OdbPacketServices odbpacketservices;
nlohmann::json::parse(row[i]).get_to(odbpacketservices);
accessandmobilitysubscriptiondata.setOdbPacketServices(
odbpacketservices);
} else if (!strcmp("serviceGapTime", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setServiceGapTime(a);
} else if (!strcmp("mdtUserConsent", field->name) && row[i] != NULL) {
MdtUserConsent mdtuserconsent;
nlohmann::json::parse(row[i]).get_to(mdtuserconsent);
accessandmobilitysubscriptiondata.setMdtUserConsent(mdtuserconsent);
} else if (!strcmp("mdtConfiguration", field->name) && row[i] != NULL) {
MdtConfiguration mdtconfiguration;
nlohmann::json::parse(row[i]).get_to(mdtconfiguration);
accessandmobilitysubscriptiondata.setMdtConfiguration(mdtconfiguration);
} else if (!strcmp("traceData", field->name) && row[i] != NULL) {
TraceData tracedata;
nlohmann::json::parse(row[i]).get_to(tracedata);
accessandmobilitysubscriptiondata.setTraceData(tracedata);
} else if (!strcmp("cagData", field->name) && row[i] != NULL) {
CagData cagdata;
nlohmann::json::parse(row[i]).get_to(cagdata);
accessandmobilitysubscriptiondata.setCagData(cagdata);
} else if (!strcmp("stnSr", field->name) && row[i] != NULL) {
accessandmobilitysubscriptiondata.setStnSr(row[i]);
} else if (!strcmp("cMsisdn", field->name) && row[i] != NULL) {
accessandmobilitysubscriptiondata.setCMsisdn(row[i]);
} else if (!strcmp("nbIoTUePriority", field->name) && row[i] != NULL) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
accessandmobilitysubscriptiondata.setNbIoTUePriority(a);
} else if (!strcmp("nssaiInclusionAllowed", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setNssaiInclusionAllowed(true);
else
accessandmobilitysubscriptiondata.setNssaiInclusionAllowed(false);
} else if (!strcmp("rgWirelineCharacteristics", field->name) &&
row[i] != NULL) {
accessandmobilitysubscriptiondata.setRgWirelineCharacteristics(row[i]);
} else if (!strcmp("ecRestrictionDataWb", field->name) &&
row[i] != NULL) {
EcRestrictionDataWb ecrestrictiondatawb;
nlohmann::json::parse(row[i]).get_to(ecrestrictiondatawb);
accessandmobilitysubscriptiondata.setEcRestrictionDataWb(
ecrestrictiondatawb);
} else if (!strcmp("ecRestrictionDataNb", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setEcRestrictionDataNb(true);
else
accessandmobilitysubscriptiondata.setEcRestrictionDataNb(false);
} else if (!strcmp("expectedUeBehaviourList", field->name) &&
row[i] != NULL) {
ExpectedUeBehaviourData expecteduebehaviourlist;
nlohmann::json::parse(row[i]).get_to(expecteduebehaviourlist);
accessandmobilitysubscriptiondata.setExpectedUeBehaviourList(
expecteduebehaviourlist);
} else if (!strcmp("primaryRatRestrictions", field->name) &&
row[i] != NULL) {
std ::vector<RatType> primaryratrestrictions;
nlohmann::json::parse(row[i]).get_to(primaryratrestrictions);
accessandmobilitysubscriptiondata.setPrimaryRatRestrictions(
primaryratrestrictions);
} else if (!strcmp("secondaryRatRestrictions", field->name) &&
row[i] != NULL) {
std ::vector<RatType> secondaryratrestrictions;
nlohmann::json::parse(row[i]).get_to(secondaryratrestrictions);
accessandmobilitysubscriptiondata.setSecondaryRatRestrictions(
secondaryratrestrictions);
} else if (!strcmp("edrxParametersList", field->name) && row[i] != NULL) {
std ::vector<EdrxParameters> edrxparameterslist;
nlohmann::json::parse(row[i]).get_to(edrxparameterslist);
accessandmobilitysubscriptiondata.setEdrxParametersList(
edrxparameterslist);
} else if (!strcmp("ptwParametersList", field->name) && row[i] != NULL) {
std ::vector<PtwParameters> ptwparameterslist;
nlohmann::json::parse(row[i]).get_to(ptwparameterslist);
accessandmobilitysubscriptiondata.setPtwParametersList(
ptwparameterslist);
} else if (!strcmp("iabOperationAllowed", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
accessandmobilitysubscriptiondata.setIabOperationAllowed(true);
else
accessandmobilitysubscriptiondata.setIabOperationAllowed(false);
} else if (!strcmp("wirelineForbiddenAreas", field->name) &&
row[i] != NULL) {
std ::vector<WirelineArea> wirelineforbiddenareas;
nlohmann::json::parse(row[i]).get_to(wirelineforbiddenareas);
accessandmobilitysubscriptiondata.setWirelineForbiddenAreas(
wirelineforbiddenareas);
} else if (!strcmp("wirelineServiceAreaRestriction", field->name) &&
row[i] != NULL) {
WirelineServiceAreaRestriction wirelineservicearearestriction;
nlohmann::json::parse(row[i]).get_to(wirelineservicearearestriction);
accessandmobilitysubscriptiondata.setWirelineServiceAreaRestriction(
wirelineservicearearestriction);
}
}
to_json(j, accessandmobilitysubscriptiondata);
// response.send(Pistache::Http::Code::Ok, j.dump());
// TODO:
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug(
"AccessAndMobilitySubscriptionData GET - json:\n\"%s\"", out.c_str());
} else {
Logger::udr_server().error("AccessAndMobilitySubscriptionData no data!");
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_amf_3gpp_access_registration_document_create_amf_context(
const std::string &ue_id,
Amf3GppAccessRegistration &amf3GppAccessRegistration,
nlohmann::json &response_data, Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_AMF3GPPAccessRegistration =
"select * from Amf3GppAccessRegistration WHERE ueid='" + ue_id + "'";
std::string query;
nlohmann::json j;
if (mysql_real_query(
&mysql, select_AMF3GPPAccessRegistration.c_str(),
(unsigned long)select_AMF3GPPAccessRegistration.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_AMF3GPPAccessRegistration.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_AMF3GPPAccessRegistration.c_str());
return;
}
if (mysql_num_rows(res)) {
query =
"update Amf3GppAccessRegistration set amfInstanceId='" +
amf3GppAccessRegistration.getAmfInstanceId() + "'" +
(amf3GppAccessRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" +
amf3GppAccessRegistration.getSupportedFeatures() + "'"
: "") +
(amf3GppAccessRegistration.purgeFlagIsSet()
? (amf3GppAccessRegistration.isPurgeFlag() ? ",purgeFlag=1"
: ",purgeFlag=0")
: "") +
(amf3GppAccessRegistration.peiIsSet()
? ",pei='" + amf3GppAccessRegistration.getPei() + "'"
: "") +
",deregCallbackUri='" +
amf3GppAccessRegistration.getDeregCallbackUri() + "'" +
(amf3GppAccessRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
amf3GppAccessRegistration.getPcscfRestorationCallbackUri() +
"'"
: "") +
(amf3GppAccessRegistration.initialRegistrationIndIsSet()
? (amf3GppAccessRegistration.isInitialRegistrationInd()
? ",initialRegistrationInd=1"
: ",initialRegistrationInd=0")
: "") +
(amf3GppAccessRegistration.drFlagIsSet()
? (amf3GppAccessRegistration.isDrFlag() ? ",drFlag=1"
: ",drFlag=0")
: "") +
(amf3GppAccessRegistration.urrpIndicatorIsSet()
? (amf3GppAccessRegistration.isUrrpIndicator()
? ",urrpIndicator=1"
: ",urrpIndicator=0")
: "") +
(amf3GppAccessRegistration.amfEeSubscriptionIdIsSet()
? ",amfEeSubscriptionId='" +
amf3GppAccessRegistration.getAmfEeSubscriptionId() + "'"
: "") +
(amf3GppAccessRegistration.ueSrvccCapabilityIsSet()
? (amf3GppAccessRegistration.isUeSrvccCapability()
? ",ueSrvccCapability=1"
: ",ueSrvccCapability=0")
: "") +
(amf3GppAccessRegistration.registrationTimeIsSet()
? ",registrationTime='" +
amf3GppAccessRegistration.getRegistrationTime() + "'"
: "") +
(amf3GppAccessRegistration.noEeSubscriptionIndIsSet()
? (amf3GppAccessRegistration.isNoEeSubscriptionInd()
? ",noEeSubscriptionInd=1"
: ",noEeSubscriptionInd=0")
: "");
if (amf3GppAccessRegistration.imsVoPsIsSet()) {
to_json(j, amf3GppAccessRegistration.getImsVoPs());
query += ",imsVoPs='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNameDeregIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNameDereg());
query += ",amfServiceNameDereg='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNamePcscfRestIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNamePcscfRest());
query += ",amfServiceNamePcscfRest='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.backupAmfInfoIsSet()) {
nlohmann::json tmp;
j.clear();
std::vector<BackupAmfInfo> backupamfinfo =
amf3GppAccessRegistration.getBackupAmfInfo();
for (int i = 0; i < backupamfinfo.size(); i++) {
to_json(tmp, backupamfinfo[i]);
j += tmp;
}
query += ",backupAmfInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.epsInterworkingInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getEpsInterworkingInfo());
query += ",epsInterworkingInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.vgmlcAddressIsSet()) {
to_json(j, amf3GppAccessRegistration.getVgmlcAddress());
query += ",vgmlcAddress='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.contextInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, amf3GppAccessRegistration.getGuami());
query += ",guami='" + j.dump() + "'";
to_json(j, amf3GppAccessRegistration.getRatType());
query += ",ratType='" + j.dump() + "'";
query += " where ueid='" + ue_id + "'";
} else {
query =
"insert into Amf3GppAccessRegistration set ueid='" + ue_id + "'" +
",amfInstanceId='" + amf3GppAccessRegistration.getAmfInstanceId() +
"'" +
(amf3GppAccessRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" +
amf3GppAccessRegistration.getSupportedFeatures() + "'"
: "") +
(amf3GppAccessRegistration.purgeFlagIsSet()
? (amf3GppAccessRegistration.isPurgeFlag() ? ",purgeFlag=1"
: ",purgeFlag=0")
: "") +
(amf3GppAccessRegistration.peiIsSet()
? ",pei='" + amf3GppAccessRegistration.getPei() + "'"
: "") +
",deregCallbackUri='" +
amf3GppAccessRegistration.getDeregCallbackUri() + "'" +
(amf3GppAccessRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
amf3GppAccessRegistration.getPcscfRestorationCallbackUri() +
"'"
: "") +
(amf3GppAccessRegistration.initialRegistrationIndIsSet()
? (amf3GppAccessRegistration.isInitialRegistrationInd()
? ",initialRegistrationInd=1"
: ",initialRegistrationInd=0")
: "") +
(amf3GppAccessRegistration.drFlagIsSet()
? (amf3GppAccessRegistration.isDrFlag() ? ",drFlag=1"
: ",drFlag=0")
: "") +
(amf3GppAccessRegistration.urrpIndicatorIsSet()
? (amf3GppAccessRegistration.isUrrpIndicator()
? ",urrpIndicator=1"
: ",urrpIndicator=0")
: "") +
(amf3GppAccessRegistration.amfEeSubscriptionIdIsSet()
? ",amfEeSubscriptionId='" +
amf3GppAccessRegistration.getAmfEeSubscriptionId() + "'"
: "") +
(amf3GppAccessRegistration.ueSrvccCapabilityIsSet()
? (amf3GppAccessRegistration.isUeSrvccCapability()
? ",ueSrvccCapability=1"
: ",ueSrvccCapability=0")
: "") +
(amf3GppAccessRegistration.registrationTimeIsSet()
? ",registrationTime='" +
amf3GppAccessRegistration.getRegistrationTime() + "'"
: "") +
(amf3GppAccessRegistration.noEeSubscriptionIndIsSet()
? (amf3GppAccessRegistration.isNoEeSubscriptionInd()
? ",noEeSubscriptionInd=1"
: ",noEeSubscriptionInd=0")
: "");
if (amf3GppAccessRegistration.imsVoPsIsSet()) {
to_json(j, amf3GppAccessRegistration.getImsVoPs());
query += ",imsVoPs='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNameDeregIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNameDereg());
query += ",amfServiceNameDereg='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.amfServiceNamePcscfRestIsSet()) {
to_json(j, amf3GppAccessRegistration.getAmfServiceNamePcscfRest());
query += ",amfServiceNamePcscfRest='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.backupAmfInfoIsSet()) {
nlohmann::json tmp;
j.clear();
std::vector<BackupAmfInfo> backupamfinfo =
amf3GppAccessRegistration.getBackupAmfInfo();
for (int i = 0; i < backupamfinfo.size(); i++) {
to_json(tmp, backupamfinfo[i]);
j += tmp;
}
query += ",backupAmfInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.epsInterworkingInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getEpsInterworkingInfo());
query += ",epsInterworkingInfo='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.vgmlcAddressIsSet()) {
to_json(j, amf3GppAccessRegistration.getVgmlcAddress());
query += ",vgmlcAddress='" + j.dump() + "'";
}
if (amf3GppAccessRegistration.contextInfoIsSet()) {
to_json(j, amf3GppAccessRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, amf3GppAccessRegistration.getGuami());
query += ",guami='" + j.dump() + "'";
to_json(j, amf3GppAccessRegistration.getRatType());
query += ",ratType='" + j.dump() + "'";
}
mysql_free_result(res);
// std::cout << query << std::endl;
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
to_json(j, amf3GppAccessRegistration);
// response.send(Pistache::Http::Code::Created, j.dump());
// TODO:
response_data = j;
code = Pistache::Http::Code::Created;
std::string out = j.dump();
Logger::udr_server().debug("Amf3GppAccessRegistration PUT - json:\n\"%s\"",
out.c_str());
}
//------------------------------------------------------------------------------
void udr_app::handle_amf_3gpp_access_registration_document_query_amf_context(
const std::string &ue_id, nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
Amf3GppAccessRegistration amf3gppaccessregistration;
const std::string query =
"select * from Amf3GppAccessRegistration WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("amfInstanceId", field->name)) {
amf3gppaccessregistration.setAmfInstanceId(row[i]);
} else if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
amf3gppaccessregistration.setSupportedFeatures(row[i]);
} else if (!strcmp("purgeFlag", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setPurgeFlag(true);
else
amf3gppaccessregistration.setPurgeFlag(false);
} else if (!strcmp("pei", field->name) && row[i] != NULL) {
amf3gppaccessregistration.setPei(row[i]);
} else if (!strcmp("imsVoPs", field->name) && row[i] != NULL) {
ImsVoPs imsvops;
nlohmann::json::parse(row[i]).get_to(imsvops);
amf3gppaccessregistration.setImsVoPs(imsvops);
} else if (!strcmp("deregCallbackUri", field->name)) {
amf3gppaccessregistration.setDeregCallbackUri(row[i]);
} else if (!strcmp("amfServiceNameDereg", field->name) &&
row[i] != NULL) {
ServiceName amfservicenamedereg;
nlohmann::json::parse(row[i]).get_to(amfservicenamedereg);
amf3gppaccessregistration.setAmfServiceNameDereg(amfservicenamedereg);
} else if (!strcmp("pcscfRestorationCallbackUri", field->name) &&
row[i] != NULL) {
amf3gppaccessregistration.setPcscfRestorationCallbackUri(row[i]);
} else if (!strcmp("amfServiceNamePcscfRest", field->name) &&
row[i] != NULL) {
ServiceName amfservicenamepcscfrest;
nlohmann::json::parse(row[i]).get_to(amfservicenamepcscfrest);
amf3gppaccessregistration.setAmfServiceNamePcscfRest(
amfservicenamepcscfrest);
} else if (!strcmp("initialRegistrationInd", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setInitialRegistrationInd(true);
else
amf3gppaccessregistration.setInitialRegistrationInd(false);
} else if (!strcmp("guami", field->name)) {
Guami guami;
nlohmann::json::parse(row[i]).get_to(guami);
amf3gppaccessregistration.setGuami(guami);
} else if (!strcmp("backupAmfInfo", field->name) && row[i] != NULL) {
std ::vector<BackupAmfInfo> backupamfinfo;
nlohmann::json::parse(row[i]).get_to(backupamfinfo);
amf3gppaccessregistration.setBackupAmfInfo(backupamfinfo);
} else if (!strcmp("drFlag", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setDrFlag(true);
else
amf3gppaccessregistration.setDrFlag(false);
} else if (!strcmp("ratType", field->name)) {
RatType rattype;
nlohmann::json::parse(row[i]).get_to(rattype);
amf3gppaccessregistration.setRatType(rattype);
} else if (!strcmp("urrpIndicator", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setUrrpIndicator(true);
else
amf3gppaccessregistration.setUrrpIndicator(false);
} else if (!strcmp("amfEeSubscriptionId", field->name) &&
row[i] != NULL) {
amf3gppaccessregistration.setAmfEeSubscriptionId(row[i]);
} else if (!strcmp("epsInterworkingInfo", field->name) &&
row[i] != NULL) {
EpsInterworkingInfo epsinterworkinginfo;
nlohmann::json::parse(row[i]).get_to(epsinterworkinginfo);
amf3gppaccessregistration.setEpsInterworkingInfo(epsinterworkinginfo);
} else if (!strcmp("ueSrvccCapability", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setUeSrvccCapability(true);
else
amf3gppaccessregistration.setUeSrvccCapability(false);
} else if (!strcmp("registrationTime", field->name) && row[i] != NULL) {
amf3gppaccessregistration.setRegistrationTime(row[i]);
} else if (!strcmp("vgmlcAddress", field->name) && row[i] != NULL) {
VgmlcAddress vgmlcaddress;
nlohmann::json::parse(row[i]).get_to(vgmlcaddress);
amf3gppaccessregistration.setVgmlcAddress(vgmlcaddress);
} else if (!strcmp("contextInfo", field->name) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
amf3gppaccessregistration.setContextInfo(contextinfo);
} else if (!strcmp("noEeSubscriptionInd", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
amf3gppaccessregistration.setNoEeSubscriptionInd(true);
else
amf3gppaccessregistration.setNoEeSubscriptionInd(false);
}
}
to_json(j, amf3gppaccessregistration);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug("Amf3GppAccessRegistration GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("Amf3GppAccessRegistration no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_create_authentication_status(const std::string &ue_id,
const AuthEvent &authEvent,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
// response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_AuthenticationStatus =
"select * from AuthenticationStatus WHERE ueid='" + ue_id + "'";
std::string query;
nlohmann::json j;
if (mysql_real_query(&mysql, select_AuthenticationStatus.c_str(),
(unsigned long)select_AuthenticationStatus.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_AuthenticationStatus.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_AuthenticationStatus.c_str());
return;
}
if (mysql_num_rows(res)) {
query = "update AuthenticationStatus set nfInstanceId='" +
authEvent.getNfInstanceId() + "'" +
",success=" + (authEvent.isSuccess() ? "1" : "0") + ",timeStamp='" +
authEvent.getTimeStamp() + "'" + ",authType='" +
authEvent.getAuthType() + "'" + ",servingNetworkName='" +
authEvent.getServingNetworkName() + "'" +
(authEvent.authRemovalIndIsSet()
? (authEvent.isAuthRemovalInd() ? ",authRemovalInd=1"
: ",authRemovalInd=0")
: "");
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
query += " where ueid='" + ue_id + "'";
} else {
query = "insert into AuthenticationStatus set ueid='" + ue_id + "'" +
",nfInstanceId='" + authEvent.getNfInstanceId() + "'" +
",success=" + (authEvent.isSuccess() ? "1" : "0") + ",timeStamp='" +
authEvent.getTimeStamp() + "'" + ",authType='" +
authEvent.getAuthType() + "'" + ",servingNetworkName='" +
authEvent.getServingNetworkName() + "'" +
(authEvent.authRemovalIndIsSet()
? (authEvent.isAuthRemovalInd() ? ",authRemovalInd=1"
: ",authRemovalInd=0")
: "");
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
}
mysql_free_result(res);
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql create failure!SQL(%s)", query.c_str());
return;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data = {};
code = Pistache::Http::Code::No_Content;
to_json(j, authEvent);
Logger::udr_server().debug("AuthenticationStatus PUT - json:\n\"%s\"",
j.dump().c_str());
}
//------------------------------------------------------------------------------
void udr_app::handle_delete_authentication_status(const std::string &ue_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
const std::string query =
"DELETE from AuthenticationStatus WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data = {};
code = Pistache::Http::Code::No_Content;
Logger::udr_server().debug("AuthenticationStatus DELETE - successful");
}
//------------------------------------------------------------------------------
void udr_app::handle_query_authentication_status(const std::string &ue_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
AuthEvent authenticationstatus;
const std::string query =
"select * from AuthenticationStatus WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!");
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("nfInstanceId", field->name)) {
authenticationstatus.setNfInstanceId(row[i]);
} else if (!strcmp("success", field->name)) {
if (strcmp(row[i], "0"))
authenticationstatus.setSuccess(true);
else
authenticationstatus.setSuccess(false);
} else if (!strcmp("timeStamp", field->name)) {
authenticationstatus.setTimeStamp(row[i]);
} else if (!strcmp("authType", field->name)) {
// AuthType authtype;
// nlohmann::json::parse(row[i]).get_to(authtype);
authenticationstatus.setAuthType(row[i]);
} else if (!strcmp("servingNetworkName", field->name)) {
authenticationstatus.setServingNetworkName(row[i]);
} else if (!strcmp("authRemovalInd", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
authenticationstatus.setAuthRemovalInd(true);
else
authenticationstatus.setAuthRemovalInd(false);
}
}
to_json(j, authenticationstatus);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
Logger::udr_server().debug("AuthenticationStatus GET - json:\n\"%s\"",
j.dump().c_str());
} else {
Logger::udr_server().error("AuthenticationStatus no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_modify_authentication_subscription(
const std::string &ue_id, const std::vector<PatchItem> &patchItem,
nlohmann::json &response_data, Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_Authenticationsubscription =
"select * from AuthenticationSubscription WHERE ueid='" + ue_id + "'";
std::string query;
nlohmann::json j, tmp_j;
for (int i = 0; i < patchItem.size(); i++) {
if ((!strcmp(patchItem[i].getOp().c_str(), PATCH_OPERATION_REPLACE)) &&
patchItem[i].valueIsSet()) {
patchItem[i].getValue();
SequenceNumber sequencenumber;
nlohmann::json::parse(patchItem[i].getValue().c_str())
.get_to(sequencenumber);
if (mysql_real_query(
&mysql, select_Authenticationsubscription.c_str(),
(unsigned long)select_Authenticationsubscription.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_Authenticationsubscription.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_Authenticationsubscription.c_str());
return;
}
if (mysql_num_rows(res)) {
nlohmann::json sequencenumber_j;
query = "update AuthenticationSubscription set sequenceNumber='";
to_json(sequencenumber_j, sequencenumber);
query += sequencenumber_j.dump() + "'";
query += " where ueid='" + ue_id + "'";
} else {
Logger::udr_server().error(
"AuthenticationSubscription no data!SQL(%s)",
select_Authenticationsubscription.c_str());
}
mysql_free_result(res);
// Logger::udr_server().debug("modify content:
// %s",query.c_str());
if (mysql_real_query(&mysql, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("update mysql failure!SQL(%s)",
query.c_str());
return;
}
}
to_json(tmp_j, patchItem[i]);
j += tmp_j;
}
std::string out = j.dump();
Logger::udr_server().debug("AuthenticationSubscription PATCH - json:\n\"%s\"",
out.c_str());
response_data = {};
code = Pistache::Http::Code::No_Content;
// response.send(Pistache::Http::Code::No_Content, "");
}
//------------------------------------------------------------------------------
void udr_app::handle_read_authentication_subscription(
const std::string &ue_id, nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
AuthenticationSubscription authenticationsubscription;
const std::string query =
"select * from AuthenticationSubscription WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("authenticationMethod", field->name)) {
// AuthMethod authenticationmethod;
// nlohmann::json::parse(row[i]).get_to(authenticationmethod);
authenticationsubscription.setAuthenticationMethod(row[i]);
} else if (!strcmp("encPermanentKey", field->name) && row[i] != NULL) {
authenticationsubscription.setEncPermanentKey(row[i]);
} else if (!strcmp("protectionParameterId", field->name) &&
row[i] != NULL) {
authenticationsubscription.setProtectionParameterId(row[i]);
} else if (!strcmp("sequenceNumber", field->name) && row[i] != NULL) {
SequenceNumber sequencenumber;
nlohmann::json::parse(row[i]).get_to(sequencenumber);
authenticationsubscription.setSequenceNumber(sequencenumber);
} else if (!strcmp("authenticationManagementField", field->name) &&
row[i] != NULL) {
authenticationsubscription.setAuthenticationManagementField(row[i]);
} else if (!strcmp("algorithmId", field->name) && row[i] != NULL) {
authenticationsubscription.setAlgorithmId(row[i]);
} else if (!strcmp("encOpcKey", field->name) && row[i] != NULL) {
authenticationsubscription.setEncOpcKey(row[i]);
} else if (!strcmp("encTopcKey", field->name) && row[i] != NULL) {
authenticationsubscription.setEncTopcKey(row[i]);
} else if (!strcmp("vectorGenerationInHss", field->name) &&
row[i] != NULL) {
std::cout << row[i] << std::endl;
if (strcmp(row[i], "0"))
authenticationsubscription.setVectorGenerationInHss(true);
else
authenticationsubscription.setVectorGenerationInHss(false);
} else if (!strcmp("n5gcAuthMethod", field->name) && row[i] != NULL) {
// AuthMethod n5gcauthmethod;
// nlohmann::json::parse(row[i]).get_to(n5gcauthmethod);
authenticationsubscription.setN5gcAuthMethod(row[i]);
} else if (!strcmp("rgAuthenticationInd", field->name) &&
row[i] != NULL) {
std::cout << row[i] << std::endl;
if (strcmp(row[i], "0"))
authenticationsubscription.setRgAuthenticationInd(true);
else
authenticationsubscription.setRgAuthenticationInd(false);
} else if (!strcmp("supi", field->name) && row[i] != NULL) {
authenticationsubscription.setSupi(row[i]);
}
}
to_json(j, authenticationsubscription);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug("AuthenticationSubscription GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("AuthenticationSubscription no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_query_sdm_subscription(const std::string &ue_id,
const std::string &subs_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
SdmSubscription SdmSubscriptions;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid='" +
ue_id + "' AND subsId=" + subs_id;
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("nfInstanceId", field->name)) {
SdmSubscriptions.setNfInstanceId(row[i]);
} else if (!strcmp("implicitUnsubscribe", field->name) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
SdmSubscriptions.setImplicitUnsubscribe(true);
else
SdmSubscriptions.setImplicitUnsubscribe(false);
} else if (!strcmp("expires", field->name) && row[i] != NULL) {
SdmSubscriptions.setExpires(row[i]);
} else if (!strcmp("callbackReference", field->name)) {
SdmSubscriptions.setCallbackReference(row[i]);
} else if (!strcmp("amfServiceName", field->name) && row[i] != NULL) {
ServiceName amfservicename;
nlohmann::json::parse(row[i]).get_to(amfservicename);
SdmSubscriptions.setAmfServiceName(amfservicename);
} else if (!strcmp("monitoredResourceUris", field->name)) {
std::vector<std::string> monitoredresourceuris;
nlohmann::json::parse(row[i]).get_to(monitoredresourceuris);
SdmSubscriptions.setMonitoredResourceUris(monitoredresourceuris);
} else if (!strcmp("singleNssai", field->name) && row[i] != NULL) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
SdmSubscriptions.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", field->name) && row[i] != NULL) {
SdmSubscriptions.setDnn(row[i]);
} else if (!strcmp("subscriptionId", field->name) && row[i] != NULL) {
SdmSubscriptions.setSubscriptionId(row[i]);
} else if (!strcmp("plmnId", field->name) && row[i] != NULL) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
SdmSubscriptions.setPlmnId(plmnid);
} else if (!strcmp("immediateReport", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
SdmSubscriptions.setImmediateReport(true);
else
SdmSubscriptions.setImmediateReport(false);
} else if (!strcmp("report", field->name) && row[i] != NULL) {
SubscriptionDataSets report;
nlohmann::json::parse(row[i]).get_to(report);
SdmSubscriptions.setReport(report);
} else if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
SdmSubscriptions.setSupportedFeatures(row[i]);
} else if (!strcmp("contextInfo", field->name) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
SdmSubscriptions.setContextInfo(contextinfo);
}
}
to_json(j, SdmSubscriptions);
response_data = j;
code = Pistache::Http::Code::Ok;
// response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscription GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("SdmSubscription no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_remove_sdm_subscription(const std::string &ue_id,
const std::string &subs_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
nlohmann::json j;
ProblemDetails problemdetails;
const std::string select_query =
"SELECT * from SdmSubscriptions WHERE ueid='" + ue_id +
"' AND subsId=" + subs_id;
const std::string query = "DELETE from SdmSubscriptions WHERE ueid='" +
ue_id + "' AND subsId=" + subs_id;
if (mysql_real_query(&mysql, select_query.c_str(),
(unsigned long)select_query.size())) {
problemdetails.setCause("USER_NOT_FOUND");
to_json(j, problemdetails);
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data = j;
code = Pistache::Http::Code::Not_Found;
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
problemdetails.setCause("USER_NOT_FOUND");
to_json(j, problemdetails);
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data = j;
code = Pistache::Http::Code::Not_Found;
return;
}
if (!mysql_num_rows(res)) {
problemdetails.setCause("DATA_NOT_FOUND");
to_json(j, problemdetails);
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data = j;
code = Pistache::Http::Code::Not_Found;
return;
}
mysql_free_result(res);
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
problemdetails.setCause("USER_NOT_FOUND");
to_json(j, problemdetails);
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data = j;
code = Pistache::Http::Code::Not_Found;
return;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data = {};
code = Pistache::Http::Code::No_Content;
Logger::udr_server().debug("SdmSubscription DELETE - successful");
}
//------------------------------------------------------------------------------
void udr_app::handle_update_sdm_subscription(const std::string &ue_id,
const std::string &subs_id,
SdmSubscription &sdmSubscription,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_query =
"SELECT * from SdmSubscriptions WHERE ueid='" + ue_id +
"' AND subsId=" + subs_id;
std::string query;
nlohmann::json j;
ProblemDetails problemdetails;
if (mysql_real_query(&mysql, select_query.c_str(),
(unsigned long)select_query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
if (mysql_num_rows(res)) {
nlohmann::json MonitoredResourceUris_json(
sdmSubscription.getMonitoredResourceUris());
query =
"update SdmSubscriptions set nfInstanceId='" +
sdmSubscription.getNfInstanceId() + "'" +
(sdmSubscription.implicitUnsubscribeIsSet()
? (sdmSubscription.isImplicitUnsubscribe()
? ",implicitUnsubscribe=1"
: ",implicitUnsubscribe=0")
: "") +
(sdmSubscription.expiresIsSet()
? ",expires='" + sdmSubscription.getExpires() + "'"
: "") +
",callbackReference='" + sdmSubscription.getCallbackReference() + "'" +
(sdmSubscription.dnnIsSet() ? ",dnn='" + sdmSubscription.getDnn() + "'"
: "") +
(sdmSubscription.subscriptionIdIsSet()
? ",subscriptionId='" + sdmSubscription.getSubscriptionId() + "'"
: "") +
(sdmSubscription.immediateReportIsSet()
? (sdmSubscription.isImmediateReport() ? ",immediateReport=1"
: ",immediateReport=0")
: "") +
(sdmSubscription.supportedFeaturesIsSet()
? ",supportedFeatures='" + sdmSubscription.getSupportedFeatures() +
"'"
: "");
if (sdmSubscription.amfServiceNameIsSet()) {
to_json(j, sdmSubscription.getAmfServiceName());
query += ",amfServiceName='" + j.dump() + "'";
}
if (sdmSubscription.singleNssaiIsSet()) {
to_json(j, sdmSubscription.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
}
if (sdmSubscription.plmnIdIsSet()) {
to_json(j, sdmSubscription.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
}
if (sdmSubscription.reportIsSet()) {
to_json(j, sdmSubscription.getReport());
query += ",report='" + j.dump() + "'";
}
if (sdmSubscription.contextInfoIsSet()) {
to_json(j, sdmSubscription.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
query +=
",monitoredResourceUris='" + MonitoredResourceUris_json.dump() + "'";
query += " where ueid='" + ue_id + "' AND subsId=" + subs_id;
} else {
to_json(j, problemdetails);
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data = j;
code = Pistache::Http::Code::Not_Found;
mysql_free_result(res);
return;
}
mysql_free_result(res);
// std::cout << query << std::endl;
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data = {};
code = Pistache::Http::Code::No_Content;
to_json(j, sdmSubscription);
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscription PUT - json:\n\"%s\"",
out.c_str());
} }
//------------------------------------------------------------------------------
void udr_app::handle_create_sdm_subscriptions(const std::string &ue_id,
SdmSubscription &sdmSubscription,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
nlohmann::json j;
int32_t subs_id = 0;
int32_t count = 0;
std::string query =
"SELECT subsId from SdmSubscriptions WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
while (row = mysql_fetch_row(res)) {
count++;
if (strcmp(row[0], std::to_string(count).c_str())) {
subs_id = count;
break;
}
}
mysql_free_result(res);
//****** add query *******
query =
"insert into SdmSubscriptions set ueid='" + ue_id + "'" +
",nfInstanceId='" + sdmSubscription.getNfInstanceId() + "'" +
(sdmSubscription.implicitUnsubscribeIsSet()
? (sdmSubscription.isImplicitUnsubscribe()
? ",implicitUnsubscribe=1"
: ",implicitUnsubscribe=0")
: "") +
(sdmSubscription.expiresIsSet()
? ",expires='" + sdmSubscription.getExpires() + "'"
: "") +
",callbackReference='" + sdmSubscription.getCallbackReference() + "'" +
(sdmSubscription.dnnIsSet() ? ",dnn='" + sdmSubscription.getDnn() + "'"
: "") +
(sdmSubscription.subscriptionIdIsSet()
? ",subscriptionId='" + sdmSubscription.getSubscriptionId() + "'"
: "") +
(sdmSubscription.immediateReportIsSet()
? (sdmSubscription.isImmediateReport() ? ",immediateReport=1"
: ",immediateReport=0")
: "") +
(sdmSubscription.supportedFeaturesIsSet()
? ",supportedFeatures='" + sdmSubscription.getSupportedFeatures() +
"'"
: "");
if (sdmSubscription.amfServiceNameIsSet()) {
to_json(j, sdmSubscription.getAmfServiceName());
query += ",amfServiceName='" + j.dump() + "'";
}
if (sdmSubscription.singleNssaiIsSet()) {
to_json(j, sdmSubscription.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
}
if (sdmSubscription.plmnIdIsSet()) {
to_json(j, sdmSubscription.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
}
if (sdmSubscription.reportIsSet()) {
to_json(j, sdmSubscription.getReport());
query += ",report='" + j.dump() + "'";
}
if (sdmSubscription.contextInfoIsSet()) {
to_json(j, sdmSubscription.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
nlohmann::json MonitoredResourceUris_json(
sdmSubscription.getMonitoredResourceUris());
query += ",monitoredResourceUris='" + MonitoredResourceUris_json.dump() + "'";
if (subs_id && (subs_id == count)) {
query += ",subsId=" + std::to_string(subs_id);
}
//************************
// std::cout << query << std::endl;
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
to_json(j, sdmSubscription);
// response.send(Pistache::Http::Code::Created, j.dump());
response_data = j;
code = Pistache::Http::Code::Created;
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscriptions POST - json:\n\"%s\"",
out.c_str());
}
//------------------------------------------------------------------------------
void udr_app::handle_query_sdm_subscriptions(const std::string &ue_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
std::vector<std::string> fields;
nlohmann::json j, tmp;
const std::string query =
"SELECT * from SdmSubscriptions WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
while (field = mysql_fetch_field(res)) {
fields.push_back(field->name);
}
j.clear();
while (row = mysql_fetch_row(res)) {
SdmSubscription sdmsubscriptions;
tmp.clear();
for (int i = 0; i < fields.size(); i++) {
if (!strcmp("nfInstanceId", fields[i].c_str())) {
sdmsubscriptions.setNfInstanceId(row[i]);
} else if (!strcmp("implicitUnsubscribe", fields[i].c_str()) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
sdmsubscriptions.setImplicitUnsubscribe(true);
else
sdmsubscriptions.setImplicitUnsubscribe(false);
} else if (!strcmp("expires", fields[i].c_str()) && row[i] != NULL) {
sdmsubscriptions.setExpires(row[i]);
} else if (!strcmp("callbackReference", fields[i].c_str())) {
sdmsubscriptions.setCallbackReference(row[i]);
} else if (!strcmp("amfServiceName", fields[i].c_str()) &&
row[i] != NULL) {
ServiceName amfservicename;
nlohmann::json::parse(row[i]).get_to(amfservicename);
sdmsubscriptions.setAmfServiceName(amfservicename);
} else if (!strcmp("monitoredResourceUris", fields[i].c_str())) {
std::vector<std::string> monitoredresourceuris;
nlohmann::json::parse(row[i]).get_to(monitoredresourceuris);
sdmsubscriptions.setMonitoredResourceUris(monitoredresourceuris);
} else if (!strcmp("singleNssai", fields[i].c_str()) && row[i] != NULL) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
sdmsubscriptions.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", fields[i].c_str()) && row[i] != NULL) {
sdmsubscriptions.setDnn(row[i]);
} else if (!strcmp("subscriptionId", fields[i].c_str()) &&
row[i] != NULL) {
sdmsubscriptions.setSubscriptionId(row[i]);
} else if (!strcmp("plmnId", fields[i].c_str()) && row[i] != NULL) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
sdmsubscriptions.setPlmnId(plmnid);
} else if (!strcmp("immediateReport", fields[i].c_str()) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
sdmsubscriptions.setImmediateReport(true);
else
sdmsubscriptions.setImmediateReport(false);
} else if (!strcmp("report", fields[i].c_str()) && row[i] != NULL) {
SubscriptionDataSets report;
nlohmann::json::parse(row[i]).get_to(report);
sdmsubscriptions.setReport(report);
} else if (!strcmp("supportedFeatures", fields[i].c_str()) &&
row[i] != NULL) {
sdmsubscriptions.setSupportedFeatures(row[i]);
} else if (!strcmp("contextInfo", fields[i].c_str()) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
sdmsubscriptions.setContextInfo(contextinfo);
}
}
to_json(tmp, sdmsubscriptions);
j += tmp;
}
mysql_free_result(res);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscriptions GET - json:\n\"%s\"",
out.c_str());
}
//------------------------------------------------------------------------------
void udr_app::handle_query_sm_data(const std::string &ue_id,
const std::string &serving_plmn_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
SessionManagementSubscriptionData sessionmanagementsubscriptiondata;
const std::string query =
"select * from SessionManagementSubscriptionData WHERE ueid='" + ue_id +
"' and servingPlmnid='" + serving_plmn_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("singleNssai", field->name)) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
sessionmanagementsubscriptiondata.setSingleNssai(singlenssai);
} else if (!strcmp("dnnConfigurations", field->name) && row[i] != NULL) {
std ::map<std ::string, DnnConfiguration> dnnconfigurations;
nlohmann::json::parse(row[i]).get_to(dnnconfigurations);
sessionmanagementsubscriptiondata.setDnnConfigurations(
dnnconfigurations);
} else if (!strcmp("internalGroupIds", field->name) && row[i] != NULL) {
std ::vector<std ::string> internalgroupIds;
nlohmann::json::parse(row[i]).get_to(internalgroupIds);
sessionmanagementsubscriptiondata.setInternalGroupIds(internalgroupIds);
} else if (!strcmp("sharedVnGroupDataIds", field->name) &&
row[i] != NULL) {
std ::map<std ::string, std ::string> sharedvngroupdataids;
nlohmann::json::parse(row[i]).get_to(sharedvngroupdataids);
sessionmanagementsubscriptiondata.setSharedVnGroupDataIds(
sharedvngroupdataids);
} else if (!strcmp("sharedDnnConfigurationsId", field->name) &&
row[i] != NULL) {
sessionmanagementsubscriptiondata.setSharedDnnConfigurationsId(row[i]);
} else if (!strcmp("odbPacketServices", field->name) && row[i] != NULL) {
OdbPacketServices odbpacketservices;
nlohmann::json::parse(row[i]).get_to(odbpacketservices);
sessionmanagementsubscriptiondata.setOdbPacketServices(
odbpacketservices);
} else if (!strcmp("traceData", field->name) && row[i] != NULL) {
TraceData tracedata;
nlohmann::json::parse(row[i]).get_to(tracedata);
sessionmanagementsubscriptiondata.setTraceData(tracedata);
} else if (!strcmp("sharedTraceDataId", field->name) && row[i] != NULL) {
sessionmanagementsubscriptiondata.setSharedTraceDataId(row[i]);
} else if (!strcmp("expectedUeBehavioursList", field->name) &&
row[i] != NULL) {
std ::map<std ::string, ExpectedUeBehaviourData>
expecteduebehaviourslist;
nlohmann::json::parse(row[i]).get_to(expecteduebehaviourslist);
sessionmanagementsubscriptiondata.setExpectedUeBehavioursList(
expecteduebehaviourslist);
} else if (!strcmp("suggestedPacketNumDlList", field->name) &&
row[i] != NULL) {
std ::map<std ::string, SuggestedPacketNumDl> suggestedpacketnumdllist;
nlohmann::json::parse(row[i]).get_to(suggestedpacketnumdllist);
sessionmanagementsubscriptiondata.setSuggestedPacketNumDlList(
suggestedpacketnumdllist);
} else if (!strcmp("3gppChargingCharacteristics", field->name) &&
row[i] != NULL) {
sessionmanagementsubscriptiondata.setR3gppChargingCharacteristics(
row[i]);
}
}
to_json(j, sessionmanagementsubscriptiondata);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug(
"SessionManagementSubscriptionData GET - json:\n\"%s\"", out.c_str());
} else {
Logger::udr_server().error(
"SessionManagementSubscriptionData no data!SQL(%s)", query.c_str());
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_create_smf_context_non_3gpp(
const std::string &ue_id, const int32_t &pdu_session_id,
const SmfRegistration &smfRegistration, nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_SmfRegistration =
"SELECT * from SmfRegistrations WHERE ueid='" + ue_id +
"' AND subpduSessionId=" + std::to_string(pdu_session_id);
std::string query;
nlohmann::json j;
if (mysql_real_query(&mysql, select_SmfRegistration.c_str(),
(unsigned long)select_SmfRegistration.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
select_SmfRegistration.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
select_SmfRegistration.c_str());
return;
}
if (mysql_num_rows(res)) {
query =
"update SmfRegistrations set smfInstanceId='" +
smfRegistration.getSmfInstanceId() + "'" +
",pduSessionId=" + std::to_string(smfRegistration.getPduSessionId()) +
(smfRegistration.smfSetIdIsSet()
? ",smfSetId='" + smfRegistration.getSmfSetId() + "'"
: "") +
(smfRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" + smfRegistration.getSupportedFeatures() +
"'"
: "") +
(smfRegistration.dnnIsSet() ? ",dnn='" + smfRegistration.getDnn() + "'"
: "") +
(smfRegistration.emergencyServicesIsSet()
? (smfRegistration.isEmergencyServices() ? ",emergencyServices=1"
: ",emergencyServices=0")
: "") +
(smfRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
smfRegistration.getPcscfRestorationCallbackUri() + "'"
: "") +
(smfRegistration.pgwFqdnIsSet()
? ",pgwFqdn='" + smfRegistration.getPgwFqdn() + "'"
: "") +
(smfRegistration.epdgIndIsSet()
? (smfRegistration.isEpdgInd() ? ",epdgInd=1" : ",epdgInd=0")
: "") +
(smfRegistration.deregCallbackUriIsSet()
? ",deregCallbackUri='" + smfRegistration.getDeregCallbackUri() +
"'"
: "") +
(smfRegistration.registrationTimeIsSet()
? ",registrationTime='" + smfRegistration.getRegistrationTime() +
"'"
: "");
if (smfRegistration.registrationReasonIsSet()) {
to_json(j, smfRegistration.getRegistrationReason());
query += ",registrationReason='" + j.dump() + "'";
}
if (smfRegistration.contextInfoIsSet()) {
to_json(j, smfRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, smfRegistration.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
to_json(j, smfRegistration.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
query += " where ueid='" + ue_id +
"' AND subpduSessionId=" + std::to_string(pdu_session_id);
} else {
query =
"insert into SmfRegistrations set ueid='" + ue_id + "'" +
",subpduSessionId=" + std::to_string(pdu_session_id) +
",pduSessionId=" + std::to_string(smfRegistration.getPduSessionId()) +
",smfInstanceId='" + smfRegistration.getSmfInstanceId() + "'" +
(smfRegistration.smfSetIdIsSet()
? ",smfSetId='" + smfRegistration.getSmfSetId() + "'"
: "") +
(smfRegistration.supportedFeaturesIsSet()
? ",supportedFeatures='" + smfRegistration.getSupportedFeatures() +
"'"
: "") +
(smfRegistration.dnnIsSet() ? ",dnn='" + smfRegistration.getDnn() + "'"
: "") +
(smfRegistration.emergencyServicesIsSet()
? (smfRegistration.isEmergencyServices() ? ",emergencyServices=1"
: ",emergencyServices=0")
: "") +
(smfRegistration.pcscfRestorationCallbackUriIsSet()
? ",pcscfRestorationCallbackUri='" +
smfRegistration.getPcscfRestorationCallbackUri() + "'"
: "") +
(smfRegistration.pgwFqdnIsSet()
? ",pgwFqdn='" + smfRegistration.getPgwFqdn() + "'"
: "") +
(smfRegistration.epdgIndIsSet()
? (smfRegistration.isEpdgInd() ? ",epdgInd=1" : ",epdgInd=0")
: "") +
(smfRegistration.deregCallbackUriIsSet()
? ",deregCallbackUri='" + smfRegistration.getDeregCallbackUri() +
"'"
: "") +
(smfRegistration.registrationTimeIsSet()
? ",registrationTime='" + smfRegistration.getRegistrationTime() +
"'"
: "");
if (smfRegistration.registrationReasonIsSet()) {
to_json(j, smfRegistration.getRegistrationReason());
query += ",registrationReason='" + j.dump() + "'";
}
if (smfRegistration.contextInfoIsSet()) {
to_json(j, smfRegistration.getContextInfo());
query += ",contextInfo='" + j.dump() + "'";
}
to_json(j, smfRegistration.getSingleNssai());
query += ",singleNssai='" + j.dump() + "'";
to_json(j, smfRegistration.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
}
mysql_free_result(res);
// std::cout << query << std::endl;
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
to_json(j, smfRegistration);
// response.send(Pistache::Http::Code::Created, j.dump());
response_data = j;
code = Pistache::Http::Code::Created;
std::string out = j.dump();
Logger::udr_server().debug("SmfRegistration PUT - json:\n\"%s\"",
out.c_str());
}
//------------------------------------------------------------------------------
void udr_app::handle_delete_smf_context(const std::string &ue_id,
const int32_t &pdu_session_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
const std::string query =
"DELETE from SmfRegistrations WHERE ueid='" + ue_id +
"' AND subpduSessionId=" + std::to_string(pdu_session_id);
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data = {};
code = Pistache::Http::Code::No_Content;
Logger::udr_server().debug("SmfRegistration DELETE - successful");
}
//------------------------------------------------------------------------------
void udr_app::handle_query_smf_registration(const std::string &ue_id,
const int32_t &pdu_session_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
SmfRegistration smfregistration;
const std::string query =
"SELECT * from SmfRegistrations WHERE ueid='" + ue_id +
"' AND subpduSessionId=" + std::to_string(pdu_session_id);
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("smfInstanceId", field->name)) {
smfregistration.setSmfInstanceId(row[i]);
} else if (!strcmp("smfSetId", field->name) && row[i] != NULL) {
smfregistration.setSmfSetId(row[i]);
} else if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
smfregistration.setSupportedFeatures(row[i]);
} else if (!strcmp("pduSessionId", field->name)) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
smfregistration.setPduSessionId(a);
} else if (!strcmp("singleNssai", field->name)) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
smfregistration.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", field->name) && row[i] != NULL) {
smfregistration.setDnn(row[i]);
} else if (!strcmp("emergencyServices", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEmergencyServices(true);
else
smfregistration.setEmergencyServices(false);
} else if (!strcmp("pcscfRestorationCallbackUri", field->name) &&
row[i] != NULL) {
smfregistration.setPcscfRestorationCallbackUri(row[i]);
} else if (!strcmp("plmnId", field->name)) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
smfregistration.setPlmnId(plmnid);
} else if (!strcmp("pgwFqdn", field->name) && row[i] != NULL) {
smfregistration.setPgwFqdn(row[i]);
} else if (!strcmp("epdgInd", field->name) && row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEpdgInd(true);
else
smfregistration.setEpdgInd(false);
} else if (!strcmp("deregCallbackUri", field->name) && row[i] != NULL) {
smfregistration.setDeregCallbackUri(row[i]);
} else if (!strcmp("registrationReason", field->name) && row[i] != NULL) {
RegistrationReason registrationreason;
nlohmann::json::parse(row[i]).get_to(registrationreason);
smfregistration.setRegistrationReason(registrationreason);
} else if (!strcmp("registrationTime", field->name) && row[i] != NULL) {
smfregistration.setRegistrationTime(row[i]);
} else if (!strcmp("contextInfo", field->name) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
smfregistration.setContextInfo(contextinfo);
}
}
to_json(j, smfregistration);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug("SmfRegistration GET - json:\n\"%s\"",
out.c_str());
} else {
Logger::udr_server().error("SmfRegistration no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
}
//------------------------------------------------------------------------------
void udr_app::handle_query_smf_reg_list(const std::string &ue_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
std::vector<std::string> fields;
nlohmann::json j, tmp;
const std::string query =
"SELECT * from SmfRegistrations WHERE ueid='" + ue_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
while (field = mysql_fetch_field(res)) {
fields.push_back(field->name);
}
j.clear();
while (row = mysql_fetch_row(res)) {
SmfRegistration smfregistration;
tmp.clear();
for (int i = 0; i < fields.size(); i++) {
if (!strcmp("smfInstanceId", fields[i].c_str())) {
smfregistration.setSmfInstanceId(row[i]);
} else if (!strcmp("smfSetId", fields[i].c_str()) && row[i] != NULL) {
smfregistration.setSmfSetId(row[i]);
} else if (!strcmp("supportedFeatures", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setSupportedFeatures(row[i]);
} else if (!strcmp("pduSessionId", fields[i].c_str())) {
std::string s = row[i];
std::stringstream ss;
int32_t a;
ss << s;
ss >> a;
smfregistration.setPduSessionId(a);
} else if (!strcmp("singleNssai", fields[i].c_str())) {
Snssai singlenssai;
nlohmann::json::parse(row[i]).get_to(singlenssai);
smfregistration.setSingleNssai(singlenssai);
} else if (!strcmp("dnn", fields[i].c_str()) && row[i] != NULL) {
smfregistration.setDnn(row[i]);
} else if (!strcmp("emergencyServices", fields[i].c_str()) &&
row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEmergencyServices(true);
else
smfregistration.setEmergencyServices(false);
} else if (!strcmp("pcscfRestorationCallbackUri", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setPcscfRestorationCallbackUri(row[i]);
} else if (!strcmp("plmnId", fields[i].c_str())) {
PlmnId plmnid;
nlohmann::json::parse(row[i]).get_to(plmnid);
smfregistration.setPlmnId(plmnid);
} else if (!strcmp("pgwFqdn", fields[i].c_str()) && row[i] != NULL) {
smfregistration.setPgwFqdn(row[i]);
} else if (!strcmp("epdgInd", fields[i].c_str()) && row[i] != NULL) {
if (strcmp(row[i], "0"))
smfregistration.setEpdgInd(true);
else
smfregistration.setEpdgInd(false);
} else if (!strcmp("deregCallbackUri", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setDeregCallbackUri(row[i]);
} else if (!strcmp("registrationReason", fields[i].c_str()) &&
row[i] != NULL) {
RegistrationReason registrationreason;
nlohmann::json::parse(row[i]).get_to(registrationreason);
smfregistration.setRegistrationReason(registrationreason);
} else if (!strcmp("registrationTime", fields[i].c_str()) &&
row[i] != NULL) {
smfregistration.setRegistrationTime(row[i]);
} else if (!strcmp("contextInfo", fields[i].c_str()) && row[i] != NULL) {
ContextInfo contextinfo;
nlohmann::json::parse(row[i]).get_to(contextinfo);
smfregistration.setContextInfo(contextinfo);
}
}
to_json(tmp, smfregistration);
j += tmp;
}
mysql_free_result(res);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug("SmfRegistrations GET - json:\n\"%s\"",
out.c_str());
}
//------------------------------------------------------------------------------
void udr_app::handle_query_smf_select_data(const std::string &ue_id,
const std::string &serving_plmn_id,
nlohmann::json &response_data,
Pistache::Http::Code &code) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
SmfSelectionSubscriptionData smfselectionsubscriptiondata;
const std::string query =
"select * from SmfSelectionSubscriptionData WHERE ueid='" + ue_id +
"' and servingPlmnid='" + serving_plmn_id + "'";
if (mysql_real_query(&mysql, query.c_str(), (unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
query.c_str());
return;
}
res = mysql_store_result(&mysql);
if (res == NULL) {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",
query.c_str());
return;
}
row = mysql_fetch_row(res);
if (row != NULL) {
for (int i = 0; field = mysql_fetch_field(res); i++) {
if (!strcmp("supportedFeatures", field->name) && row[i] != NULL) {
smfselectionsubscriptiondata.setSupportedFeatures(row[i]);
} else if (!strcmp("subscribedSnssaiInfos", field->name) &&
row[i] != NULL) {
std ::map<std ::string, SnssaiInfo> subscribedsnssaiinfos;
nlohmann::json::parse(row[i]).get_to(subscribedsnssaiinfos);
smfselectionsubscriptiondata.setSubscribedSnssaiInfos(
subscribedsnssaiinfos);
} else if (!strcmp("sharedSnssaiInfosId", field->name) &&
row[i] != NULL) {
smfselectionsubscriptiondata.setSharedSnssaiInfosId(row[i]);
}
}
to_json(j, smfselectionsubscriptiondata);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data = j;
code = Pistache::Http::Code::Ok;
std::string out = j.dump();
Logger::udr_server().debug(
"SmfSelectionSubscriptionData GET - json:\n\"%s\"", out.c_str());
} else {
Logger::udr_server().error("SmfSelectionSubscriptionData no data!SQL(%s)",
query.c_str());
}
mysql_free_result(res);
}
...@@ -30,11 +30,21 @@ ...@@ -30,11 +30,21 @@
#ifndef FILE_UDR_APP_HPP_SEEN #ifndef FILE_UDR_APP_HPP_SEEN
#define FILE_UDR_APP_HPP_SEEN #define FILE_UDR_APP_HPP_SEEN
#include <string> #include <mysql/mysql.h>
#include <pistache/http.h> #include <pistache/http.h>
#include <map> #include <map>
#include <shared_mutex>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <shared_mutex>
#include <string>
#include "Amf3GppAccessRegistration.h"
#include "AuthEvent.h"
#include "PatchItem.h"
#include "SdmSubscription.h"
#include "SmfRegistration.h"
using namespace oai::udr::model;
namespace oai { namespace oai {
namespace udr { namespace udr {
...@@ -50,10 +60,94 @@ class udr_app { ...@@ -50,10 +60,94 @@ class udr_app {
virtual ~udr_app(); virtual ~udr_app();
void handle_access_mobility_subscription_data_document( void handle_access_mobility_subscription_data_document(
const std::string &ue_id, const std::string &serving_plmn_id, nlohmann::json& response_data, const std::string& ue_id, const std::string& serving_plmn_id,
nlohmann::json& response_data, Pistache::Http::Code& code);
void handle_amf_3gpp_access_registration_document_create_amf_context(
const std::string& ue_id,
Amf3GppAccessRegistration& amf3GppAccessRegistration,
nlohmann::json& response_data, Pistache::Http::Code& code);
void handle_amf_3gpp_access_registration_document_query_amf_context(
const std::string& ue_id, nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_create_authentication_status(const std::string& ue_id,
const AuthEvent& authEvent,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_delete_authentication_status(const std::string& ue_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_authentication_status(const std::string& ue_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_modify_authentication_subscription(
const std::string& ue_id, const std::vector<PatchItem>& patchItem,
nlohmann::json& response_data, Pistache::Http::Code& code);
void handle_read_authentication_subscription(const std::string& ue_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_sdm_subscription(const std::string& ue_id,
const std::string& subs_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_remove_sdm_subscription(const std::string& ue_id,
const std::string& subs_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_update_sdm_subscription(const std::string& ue_id,
const std::string& subs_id,
SdmSubscription& sdmSubscription,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_create_sdm_subscriptions(const std::string& ue_id,
SdmSubscription& sdmSubscription,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_sdm_subscriptions(const std::string& ue_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_sm_data(const std::string& ue_id,
const std::string& serving_plmn_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_create_smf_context_non_3gpp(
const std::string& ue_id, const int32_t& pdu_session_id,
const SmfRegistration& smfRegistration, nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_delete_smf_context(const std::string& ue_id,
const int32_t& pdu_session_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_smf_registration(const std::string& ue_id,
const int32_t& pdu_session_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_smf_reg_list(const std::string& ue_id,
nlohmann::json& response_data,
Pistache::Http::Code& code);
void handle_query_smf_select_data(const std::string& ue_id,
const std::string& serving_plmn_id,
nlohmann::json& response_data,
Pistache::Http::Code& code); Pistache::Http::Code& code);
private: private:
MYSQL mysql;
}; };
} // namespace app } // namespace app
} // namespace udr } // namespace udr
......
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