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

First running version for UDR

parent 8b6feda9
......@@ -20,24 +20,20 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <AMF3GPPAccessRegistrationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "Amf3GppAccessRegistration.h"
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include <mysql/mysql.h>
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -53,7 +49,7 @@ class AMF3GPPAccessRegistrationDocumentApiImpl
public:
AMF3GPPAccessRegistrationDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql);
std::string address);
~AMF3GPPAccessRegistrationDocumentApiImpl() {}
void amf_context3gpp(const std::string &ueId,
......@@ -69,11 +65,8 @@ class AMF3GPPAccessRegistrationDocumentApiImpl
const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -20,23 +20,21 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <AMFNon3GPPAccessRegistrationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "Amf3GppAccessRegistration.h"
#include "AmfNon3GppAccessRegistration.h"
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef ACCESS_AND_MOBILITY_DATA_API_IMPL_H_
#define ACCESS_AND_MOBILITY_DATA_API_IMPL_H_
#include <AccessAndMobilityDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessAndMobilityDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AccessAndMobilityData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessAndMobilityPolicyDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AmPolicyData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessAndMobilitySubscriptionDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AccessAndMobilitySubscriptionData.h"
#include <mysql/mysql.h>
#include "AccessAndMobilitySubscriptionData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -49,7 +45,7 @@ class AccessAndMobilitySubscriptionDataDocumentApiImpl
public:
AccessAndMobilitySubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql);
std::string address);
~AccessAndMobilitySubscriptionDataDocumentApiImpl() {}
void query_am_data(
......@@ -59,11 +55,8 @@ class AccessAndMobilitySubscriptionDataDocumentApiImpl
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -20,21 +20,19 @@
#ifndef _AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#define _AMF_SUBSCRIPTION_INFO_DOCUMENT_API_IMPL_H_
#include <AmfSubscriptionInfoDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AmfSubscriptionInfoDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef APPLICATION_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define APPLICATION_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <ApplicationDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <ApplicationDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <memory>
#include "ApplicationDataSubs.h"
#include "DataFilter.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef AUTHENTICATION_SO_R_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_SO_R_DOCUMENT_API_IMPL_H_
#include <AuthenticationSoRDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationSoRDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SorData.h"
#include "SorData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -12,7 +12,6 @@
*/
#include "AuthenticationStatusDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
......@@ -25,161 +24,43 @@ using namespace oai::udr::model;
AuthenticationStatusDocumentApiImpl::AuthenticationStatusDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql)
std::string address)
: AuthenticationStatusDocumentApi(rtr),
m_udr_app(udr_app_inst),
m_address(address) {
mysql_WitcommUDRDB = mysql;
}
m_address(address) {}
void AuthenticationStatusDocumentApiImpl::create_authentication_status(
const std::string &ueId, const AuthEvent &authEvent,
Pistache::Http::ResponseWriter &response) {
// 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='" + 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;
}
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_create_authentication_status(ueId, authEvent, response_data,
code);
res = mysql_store_result(mysql_WitcommUDRDB);
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='" + 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());
Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
}
void AuthenticationStatusDocumentApiImpl::delete_authentication_status(
const std::string &ueId, Pistache::Http::ResponseWriter &response) {
const std::string query =
"DELETE 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;
}
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_delete_authentication_status(ueId, response_data, code);
response.send(Pistache::Http::Code::No_Content, "");
Logger::udr_server().debug("AuthenticationStatus DELETE - successful");
Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
}
void AuthenticationStatusDocumentApiImpl::query_authentication_status(
const std::string &ueId,
const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) {
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='" + 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());
}
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_authentication_status(ueId, 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
......@@ -20,20 +20,16 @@
#ifndef AUTHENTICATION_STATUS_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_STATUS_DOCUMENT_API_IMPL_H_
#include <AuthenticationStatusDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationStatusDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AuthEvent.h"
#include <mysql/mysql.h>
#include "AuthEvent.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -49,7 +45,7 @@ class AuthenticationStatusDocumentApiImpl
public:
AuthenticationStatusDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst,
std::string address, MYSQL *mysql);
std::string address);
~AuthenticationStatusDocumentApiImpl() {}
void create_authentication_status(const std::string &ueId,
......@@ -63,11 +59,8 @@ class AuthenticationStatusDocumentApiImpl
const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -12,11 +12,10 @@
*/
#include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "PatchResult.h"
#include "logger.hpp"
#include <AuthenticationSubscription.h>
#include "PatchResult.h"
#include "logger.hpp"
#include "udr_app.hpp"
#include "udr_config.hpp"
......@@ -29,82 +28,23 @@ using namespace oai::udr::model;
AuthenticationSubscriptionDocumentApiImpl::
AuthenticationSubscriptionDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql)
std::string address)
: AuthenticationSubscriptionDocumentApi(rtr),
m_udr_app(udr_app_inst),
m_address(address) {
mysql_WitcommUDRDB = mysql;
}
m_address(address) {}
void AuthenticationSubscriptionDocumentApiImpl::
modify_authentication_subscription(
const std::string &ueId, const std::vector<PatchItem> &patchItem,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_Authenticationsubscription =
"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;
}
}
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_modify_authentication_subscription(ueId, patchItem,
response_data, code);
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.send(Pistache::Http::Code::No_Content, "");
Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
}
void AuthenticationSubscriptionDocumentApiImpl::
......@@ -112,91 +52,12 @@ void AuthenticationSubscriptionDocumentApiImpl::
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) {
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='" + 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());
}
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_read_authentication_subscription(ueId, 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
......@@ -20,23 +20,19 @@
#ifndef AUTHENTICATION_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <AuthenticationSubscriptionDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include <mysql/mysql.h>
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -52,7 +48,7 @@ class AuthenticationSubscriptionDocumentApiImpl
public:
AuthenticationSubscriptionDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql);
std::string address);
~AuthenticationSubscriptionDocumentApiImpl() {}
void modify_authentication_subscription(
......@@ -63,11 +59,8 @@ class AuthenticationSubscriptionDocumentApiImpl
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -20,18 +20,16 @@
#ifndef AUTHENTICATION_UPU_DOCUMENT_API_IMPL_H_
#define AUTHENTICATION_UPU_DOCUMENT_API_IMPL_H_
#include <AuthenticationUPUDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthenticationUPUDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "UpuData.h"
#include "UpuData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef BDT_DATA_STORE_API_IMPL_H_
#define BDT_DATA_STORE_API_IMPL_H_
#include <BdtDataStoreApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <BdtDataStoreApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "BdtData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef BDT_POLICY_DATA_STORE_API_IMPL_H_
#define BDT_POLICY_DATA_STORE_API_IMPL_H_
#include <BdtPolicyDataStoreApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <BdtPolicyDataStoreApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "BdtPolicyData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef CAGACK_DOCUMENT_API_IMPL_H_
#define CAGACK_DOCUMENT_API_IMPL_H_
#include <CAGACKDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <CAGACKDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "CagAckData.h"
#include "CagAckData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef CAG_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#define CAG_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#include <CAGUpdateAckDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <CAGUpdateAckDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "CagAckData.h"
#include "CagAckData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <Class5GVNGroupsInternalDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "5GVnGroupConfiguration.h"
#include "5GVnGroupConfiguration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef CLASS5_GVN_GROUPS_STORE_API_IMPL_H_
#define CLASS5_GVN_GROUPS_STORE_API_IMPL_H_
#include <Class5GVNGroupsStoreApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Class5GVNGroupsStoreApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "5GVnGroupConfiguration.h"
#include "5GVnGroupConfiguration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <Class5GVnGroupConfigurationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "5GVnGroupConfiguration.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,14 +20,13 @@
#ifndef CONTEXT_DATA_DOCUMENT_API_IMPL_H_
#define CONTEXT_DATA_DOCUMENT_API_IMPL_H_
#include <ContextDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <ContextDataDocumentApi.h>
#include <pistache/optional.h>
#include <memory>
#include "ContextDataSetName.h"
#include "ContextDataSets.h"
......
......@@ -20,15 +20,13 @@
#ifndef DELETE5_G_VN_GROUP_API_IMPL_H_
#define DELETE5_G_VN_GROUP_API_IMPL_H_
#include <Delete5GVnGroupApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Delete5GVnGroupApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "udr_app.hpp"
......
......@@ -20,18 +20,16 @@
#ifndef ENHANCED_COVERAGE_RESTRICTION_DATA_API_IMPL_H_
#define ENHANCED_COVERAGE_RESTRICTION_DATA_API_IMPL_H_
#include <EnhancedCoverageRestrictionDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EnhancedCoverageRestrictionDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "EnhancedCoverageRestrictionData.h"
#include "EnhancedCoverageRestrictionData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,15 +20,13 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventAMFSubscriptionInfoDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "udr_app.hpp"
......
......@@ -20,18 +20,16 @@
#ifndef EVENT_EXPOSURE_DATA_DOCUMENT_API_IMPL_H_
#define EVENT_EXPOSURE_DATA_DOCUMENT_API_IMPL_H_
#include <EventExposureDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "EeProfileData.h"
#include "EeProfileData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,23 +20,22 @@
#ifndef 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/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureGroupSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <memory>
#include "EeSubscription.h"
//#include "Object.h"
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureGroupSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "EeSubscription.h"
#include "EeSubscription.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,23 +20,22 @@
#ifndef EVENT_EXPOSURE_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define EVENT_EXPOSURE_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <EventExposureSubscriptionDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <memory>
#include "EeSubscription.h"
//#include "Object.h"
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef EVENT_EXPOSURE_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define EVENT_EXPOSURE_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <EventExposureSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <EventExposureSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "EeSubscription.h"
#include "EeSubscription.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef EXPOSURE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define EXPOSURE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <ExposureDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <ExposureDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <memory>
#include "ExposureDataSubscription.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef GROUP_IDENTIFIERS_API_IMPL_H_
#define GROUP_IDENTIFIERS_API_IMPL_H_
#include <GroupIdentifiersApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <GroupIdentifiersApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "GroupIdentifiers.h"
#include "GroupIdentifiers.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,21 +20,19 @@
#ifndef IPSMGW_REGISTRATION_DOCUMENT_API_IMPL_H_
#define IPSMGW_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <IPSMGWRegistrationDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IPSMGWRegistrationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "IpSmGwRegistration.h"
#include "PatchItem.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef IPTV_CONFIGURATION_DATA_STORE_API_IMPL_H_
#define IPTV_CONFIGURATION_DATA_STORE_API_IMPL_H_
#include <IPTVConfigurationDataStoreApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IPTVConfigurationDataStoreApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "IptvConfigData.h"
#include "ProblemDetails.h"
#include "Snssai.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualApplicationDataSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ApplicationDataSubs.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualAppliedBDTPolicyDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "BdtPolicyData.h"
#include "BdtPolicyDataPatch.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualBDTPolicyDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "BdtPolicyData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_BDT_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_BDT_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualBdtDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualBdtDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "BdtData.h"
#include "BdtDataPatch.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualExposureDataSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ExposureDataSubscription.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_IPTV_CONFIGURATION_DATA_API_IMPL_H_
#define INDIVIDUAL_IPTV_CONFIGURATION_DATA_API_IMPL_H_
#include <IndividualIPTVConfigurationDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualIPTVConfigurationDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "IptvConfigData.h"
#include "IptvConfigDataPatch.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualIPTVConfigurationDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "IptvConfigData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef INDIVIDUAL_INFLUENCE_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_INFLUENCE_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualInfluenceDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualInfluenceDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "TrafficInfluData.h"
#include "TrafficInfluDataPatch.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualInfluenceDataSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "TrafficInfluSub.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef INDIVIDUAL_PFD_DATA_DOCUMENT_API_IMPL_H_
#define INDIVIDUAL_PFD_DATA_DOCUMENT_API_IMPL_H_
#include <IndividualPFDDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualPFDDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "PfdDataForAppExt.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualPolicyDataSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "PolicyDataSubscription.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef INFLUENCE_DATA_STORE_API_IMPL_H_
#define INFLUENCE_DATA_STORE_API_IMPL_H_
#include <InfluenceDataStoreApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <InfluenceDataStoreApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "Snssai.h"
#include "TrafficInfluData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef INFLUENCE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define INFLUENCE_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <InfluenceDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <InfluenceDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "Snssai.h"
#include "TrafficInfluSub.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <LCSBroadcastAssistanceSubscriptionDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "LcsBroadcastAssistanceTypesData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <LCSMobileOriginatedSubscriptionDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "LcsMoData.h"
#include "LcsMoData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef LCS_PRIVACY_SUBSCRIPTION_DATA_API_IMPL_H_
#define LCS_PRIVACY_SUBSCRIPTION_DATA_API_IMPL_H_
#include <LCSPrivacySubscriptionDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <LCSPrivacySubscriptionDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "LcsPrivacyData.h"
#include "LcsPrivacyData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,21 +20,19 @@
#ifndef MESSAGE_WAITING_DATA_DOCUMENT_API_IMPL_H_
#define MESSAGE_WAITING_DATA_DOCUMENT_API_IMPL_H_
#include <MessageWaitingDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <MessageWaitingDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "MessageWaitingData.h"
#include "PatchItem.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,21 +20,19 @@
#ifndef MODIFY5_G_VN_GROUP_API_IMPL_H_
#define MODIFY5_G_VN_GROUP_API_IMPL_H_
#include <Modify5GVnGroupApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <Modify5GVnGroupApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef NSSAIACK_DOCUMENT_API_IMPL_H_
#define NSSAIACK_DOCUMENT_API_IMPL_H_
#include <NSSAIACKDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <NSSAIACKDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "NssaiAckData.h"
#include "NssaiAckData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef NSSAI_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#define NSSAI_UPDATE_ACK_DOCUMENT_API_IMPL_H_
#include <NSSAIUpdateAckDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <NSSAIUpdateAckDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "NssaiAckData.h"
#include "NssaiAckData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,22 +20,20 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <OperatorSpecificDataContainerDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "OperatorSpecificDataContainer.h"
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,23 +20,21 @@
#ifndef OPERATOR_SPECIFIC_DATA_DOCUMENT_API_IMPL_H_
#define OPERATOR_SPECIFIC_DATA_DOCUMENT_API_IMPL_H_
#include <OperatorSpecificDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <OperatorSpecificDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "OperatorSpecificDataContainer.h"
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef PFD_DATA_STORE_API_IMPL_H_
#define PFD_DATA_STORE_API_IMPL_H_
#include <PFDDataStoreApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <PFDDataStoreApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "PfdDataForAppExt.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef PARAMETER_PROVISION_DOCUMENT_API_IMPL_H_
#define PARAMETER_PROVISION_DOCUMENT_API_IMPL_H_
#include <ParameterProvisionDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <ParameterProvisionDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "PpData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef PDU_SESSION_MANAGEMENT_DATA_API_IMPL_H_
#define PDU_SESSION_MANAGEMENT_DATA_API_IMPL_H_
#include <PduSessionManagementDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <PduSessionManagementDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "Ipv6Prefix.h"
#include "PduSessionManagementData.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <PlmnUePolicySetDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "UePolicySet.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef POLICY_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define POLICY_DATA_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <PolicyDataSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <PolicyDataSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <memory>
#include "PolicyDataSubscription.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,14 +20,13 @@
#ifndef PROVISIONED_DATA_DOCUMENT_API_IMPL_H_
#define PROVISIONED_DATA_DOCUMENT_API_IMPL_H_
#include <ProvisionedDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <ProvisionedDataDocumentApi.h>
#include <pistache/optional.h>
#include <memory>
#include "DataSetName.h"
#include "ProvisionedDataSets.h"
......
......@@ -20,21 +20,19 @@
#ifndef PROVISIONED_PARAMETER_DATA_DOCUMENT_API_IMPL_H_
#define PROVISIONED_PARAMETER_DATA_DOCUMENT_API_IMPL_H_
#include <ProvisionedParameterDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <ProvisionedParameterDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <Query5GVnGroupConfigurationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "5GVnGroupConfiguration.h"
#include "5GVnGroupConfiguration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryAMFSubscriptionInfoDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AmfSubscriptionInfo.h"
#include "AmfSubscriptionInfo.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryIdentityDataBySUPIOrGPSIDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AppPortId.h"
#include "IdentityData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#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_
#include <QueryNIDDAuthorizationDataGPSIOrExternalGroupIdentifierDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryNIDDAuthorizationDataGPSIOrExternalGroupIdentifierDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "AuthorizationData.h"
#include "Snssai.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <QueryODBDataBySUPIOrGPSIDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "OdbData.h"
#include "OdbData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,19 @@
#ifndef RETRIEVAL_OF_SHARED_DATA_API_IMPL_H_
#define RETRIEVAL_OF_SHARED_DATA_API_IMPL_H_
#include <RetrievalOfSharedDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <RetrievalOfSharedDataApi.h>
#include <pistache/optional.h>
#include <memory>
#include "ProblemDetails.h"
//#include "Set.h"
#include <string>
#include "SharedData.h"
#include "SharedData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,25 +20,22 @@
#ifndef SDM_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#define SDM_SUBSCRIPTION_DOCUMENT_API_IMPL_H_
#include <SDMSubscriptionDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <SDMSubscriptionDocumentApi.h>
#include <pistache/optional.h>
#include <memory>
//#include "Object.h"
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "SdmSubscription.h"
#include <mysql/mysql.h>
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -53,8 +50,7 @@ class SDMSubscriptionDocumentApiImpl
public:
SDMSubscriptionDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address,
MYSQL *mysql);
udr_app *udr_app_inst, std::string address);
~SDMSubscriptionDocumentApiImpl() {}
void modifysdm_subscription(
......@@ -71,11 +67,8 @@ class SDMSubscriptionDocumentApiImpl
const std::string &subsId,
SdmSubscription &sdmSubscription,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -12,7 +12,6 @@
*/
#include "SDMSubscriptionsCollectionApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
......@@ -25,224 +24,32 @@ using namespace oai::udr::model;
SDMSubscriptionsCollectionApiImpl::SDMSubscriptionsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql)
std::string address)
: SDMSubscriptionsCollectionApi(rtr),
m_udr_app(udr_app_inst),
m_address(address) {
mysql_WitcommUDRDB = mysql;
}
m_address(address) {}
void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(
const std::string &ueId, SdmSubscription &sdmSubscription,
Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
nlohmann::json j;
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());
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_create_sdm_subscriptions(ueId, sdmSubscription,
response_data, code);
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscriptions POST - json:\n\"%s\"",
out.c_str());
Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
}
void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) {
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='" + 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());
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_sdm_subscriptions(ueId, response_data, code);
std::string out = j.dump();
Logger::udr_server().debug("SdmSubscriptions GET - json:\n\"%s\"",
out.c_str());
Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
}
} // namespace oai::udr::api
......@@ -20,20 +20,16 @@
#ifndef SDM_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#define SDM_SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
#include <SDMSubscriptionsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SDMSubscriptionsCollectionApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SdmSubscription.h"
#include <mysql/mysql.h>
#include "SdmSubscription.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -48,8 +44,7 @@ class SDMSubscriptionsCollectionApiImpl
public:
SDMSubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address,
MYSQL *mysql);
udr_app *udr_app_inst, std::string address);
~SDMSubscriptionsCollectionApiImpl() {}
void create_sdm_subscriptions(const std::string &ueId,
......@@ -59,11 +54,8 @@ class SDMSubscriptionsCollectionApiImpl
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -20,20 +20,16 @@
#ifndef SMF_REGISTRATION_DOCUMENT_API_IMPL_H_
#define SMF_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <SMFRegistrationDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMFRegistrationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmfRegistration.h"
#include <mysql/mysql.h>
#include "SmfRegistration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -48,8 +44,7 @@ class SMFRegistrationDocumentApiImpl
public:
SMFRegistrationDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address,
MYSQL *mysql);
udr_app *udr_app_inst, std::string address);
~SMFRegistrationDocumentApiImpl() {}
void create_smf_context_non3gpp(const std::string &ueId,
......@@ -63,11 +58,8 @@ class SMFRegistrationDocumentApiImpl
const Pistache::Optional<std::vector<std::string>> &fields,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -12,7 +12,6 @@
*/
#include "SMFRegistrationsCollectionApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
......@@ -25,121 +24,21 @@ using namespace oai::udr::model;
SMFRegistrationsCollectionApiImpl::SMFRegistrationsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql)
std::string address)
: SMFRegistrationsCollectionApi(rtr),
m_udr_app(udr_app_inst),
m_address(address) {
mysql_WitcommUDRDB = mysql;
}
m_address(address) {}
void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) {
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='" + 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());
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_smf_reg_list(ueId, response_data, code);
std::string out = j.dump();
Logger::udr_server().debug("SmfRegistrations GET - json:\n\"%s\"",
out.c_str());
Logger::udr_server().debug("HTTP reponse code %d.\n", code);
response.send(code, response_data.dump());
}
} // namespace oai::udr::api
......@@ -20,20 +20,16 @@
#ifndef SMF_REGISTRATIONS_COLLECTION_API_IMPL_H_
#define SMF_REGISTRATIONS_COLLECTION_API_IMPL_H_
#include <SMFRegistrationsCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMFRegistrationsCollectionApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmfRegistration.h"
#include <mysql/mysql.h>
#include "SmfRegistration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -48,19 +44,15 @@ class SMFRegistrationsCollectionApiImpl
public:
SMFRegistrationsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
udr_app *udr_app_inst, std::string address,
MYSQL *mysql);
udr_app *udr_app_inst, std::string address);
~SMFRegistrationsCollectionApiImpl() {}
void query_smf_reg_list(
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -12,7 +12,6 @@
*/
#include "SMFSelectionSubscriptionDataDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
......@@ -26,12 +25,10 @@ using namespace oai::udr::model;
SMFSelectionSubscriptionDataDocumentApiImpl::
SMFSelectionSubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql)
std::string address)
: SMFSelectionSubscriptionDataDocumentApi(rtr),
m_udr_app(udr_app_inst),
m_address(address) {
mysql_WitcommUDRDB = mysql;
}
m_address(address) {}
void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(
const std::string &ueId, const std::string &servingPlmnId,
......@@ -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> &ifModifiedSince,
Pistache::Http::ResponseWriter &response) {
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='" + 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());
}
nlohmann::json response_data = {};
Pistache::Http::Code code = {};
m_udr_app->handle_query_smf_select_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
......@@ -20,20 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMFSelectionSubscriptionDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmfSelectionSubscriptionData.h"
#include <mysql/mysql.h>
#include "SmfSelectionSubscriptionData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -49,7 +45,7 @@ class SMFSelectionSubscriptionDataDocumentApiImpl
public:
SMFSelectionSubscriptionDataDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql);
std::string address);
~SMFSelectionSubscriptionDataDocumentApiImpl() {}
void query_smf_select_data(
......@@ -59,11 +55,8 @@ class SMFSelectionSubscriptionDataDocumentApiImpl
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -20,18 +20,16 @@
#ifndef SMSF3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_
#define SMSF3_GPP_REGISTRATION_DOCUMENT_API_IMPL_H_
#include <SMSF3GPPRegistrationDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSF3GPPRegistrationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmsfRegistration.h"
#include "SmsfRegistration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSFNon3GPPRegistrationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmsfRegistration.h"
#include "SmsfRegistration.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSManagementSubscriptionDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmsManagementSubscriptionData.h"
#include "SmsManagementSubscriptionData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef SMS_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#define SMS_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#include <SMSSubscriptionDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SMSSubscriptionDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SmsSubscriptionData.h"
#include "SmsSubscriptionData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,21 +20,19 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <SessionManagementPolicyDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "SmPolicyData.h"
#include "SmPolicyDataPatch.h"
#include "Snssai.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -12,7 +12,6 @@
*/
#include "SessionManagementSubscriptionDataApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
......@@ -26,12 +25,10 @@ using namespace oai::udr::model;
SessionManagementSubscriptionDataApiImpl::
SessionManagementSubscriptionDataApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
std::string address, MYSQL *mysql)
std::string address)
: SessionManagementSubscriptionDataApi(rtr),
m_udr_app(udr_app_inst),
m_address(address) {
mysql_WitcommUDRDB = mysql;
}
m_address(address) {}
void SessionManagementSubscriptionDataApiImpl::query_sm_data(
const std::string &ueId, const std::string &servingPlmnId,
......@@ -44,99 +41,22 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(
Pistache::Http::ResponseWriter &response) {
// response.send(Pistache::Http::Code::Ok, "query_sm_data\n");
// 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;
Snssai snssai = {};
if (!singleNssai.isEmpty()) {
snssai = singleNssai.get();
}
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("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());
std::string dnn_str = {};
if (!dnn.isEmpty()) {
dnn_str = dnn.get();
}
// 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
......@@ -20,21 +20,17 @@
#ifndef SESSION_MANAGEMENT_SUBSCRIPTION_DATA_API_IMPL_H_
#define SESSION_MANAGEMENT_SUBSCRIPTION_DATA_API_IMPL_H_
#include <SessionManagementSubscriptionDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SessionManagementSubscriptionDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SessionManagementSubscriptionData.h"
#include "Snssai.h"
#include <mysql/mysql.h>
#include "udr_app.hpp"
namespace oai::udr::api {
......@@ -50,7 +46,7 @@ class SessionManagementSubscriptionDataApiImpl
public:
SessionManagementSubscriptionDataApiImpl(
std::shared_ptr<Pistache::Rest::Router>, udr_app *udr_app_inst,
std::string address, MYSQL *mysql);
std::string address);
~SessionManagementSubscriptionDataApiImpl() {}
void query_sm_data(
......@@ -62,11 +58,8 @@ class SessionManagementSubscriptionDataApiImpl
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
Pistache::Http::ResponseWriter &response);
private:
MYSQL *mysql_WitcommUDRDB;
};
} // namespace oai::udr::api
#endif
\ No newline at end of file
#endif
......@@ -20,19 +20,17 @@
#ifndef SPONSOR_CONNECTIVITY_DATA_DOCUMENT_API_IMPL_H_
#define SPONSOR_CONNECTIVITY_DATA_DOCUMENT_API_IMPL_H_
#include <SponsorConnectivityDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SponsorConnectivityDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "SponsorConnectivityData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef SUBS_TO_NOTIFY_COLLECTION_API_IMPL_H_
#define SUBS_TO_NOTIFY_COLLECTION_API_IMPL_H_
#include <SubsToNotifyCollectionApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <SubsToNotifyCollectionApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "SubscriptionDataSubscriptions.h"
#include "SubscriptionDataSubscriptions.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,22 +20,21 @@
#ifndef SUBS_TO_NOTIFY_DOCUMENT_API_IMPL_H_
#define SUBS_TO_NOTIFY_DOCUMENT_API_IMPL_H_
#include <SubsToNotifyDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <SubsToNotifyDocumentApi.h>
#include <pistache/optional.h>
#include <memory>
//#include "Object.h"
#include <string>
#include <vector>
#include "PatchItem.h"
#include "PatchResult.h"
#include "ProblemDetails.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef TRACE_DATA_DOCUMENT_API_IMPL_H_
#define TRACE_DATA_DOCUMENT_API_IMPL_H_
#include <TraceDataDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <TraceDataDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "TraceData.h"
#include "TraceData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,20 +20,18 @@
#ifndef UE_POLICY_SET_DOCUMENT_API_IMPL_H_
#define UE_POLICY_SET_DOCUMENT_API_IMPL_H_
#include <UEPolicySetDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <UEPolicySetDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "UePolicySet.h"
#include "UePolicySetPatch.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef 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/http.h>
#include <pistache/router.h>
#include <memory>
#include <UEsLocationInformationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "LocationInfo.h"
#include "LocationInfo.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,19 +20,17 @@
#ifndef USAGE_MONITORING_INFORMATION_DOCUMENT_API_IMPL_H_
#define USAGE_MONITORING_INFORMATION_DOCUMENT_API_IMPL_H_
#include <UsageMonitoringInformationDocumentApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <UsageMonitoringInformationDocumentApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "ProblemDetails.h"
#include "UsageMonData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -20,18 +20,16 @@
#ifndef V2_X_SUBSCRIPTION_DATA_API_IMPL_H_
#define V2_X_SUBSCRIPTION_DATA_API_IMPL_H_
#include <V2XSubscriptionDataApi.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <V2XSubscriptionDataApi.h>
#include <pistache/optional.h>
#include <pistache/router.h>
#include <memory>
#include <string>
#include "V2xSubscriptionData.h"
#include "V2xSubscriptionData.h"
#include "udr_app.hpp"
namespace oai::udr::api {
......
......@@ -66,8 +66,8 @@ void setUpUnixSignals(std::vector<int> quitSignals) {
struct sigaction sa;
sa.sa_handler = sigHandler;
sa.sa_mask = blocking_mask;
sa.sa_flags = 0;
sa.sa_mask = blocking_mask;
sa.sa_flags = 0;
for (auto sig : quitSignals) sigaction(sig, &sa, nullptr);
}
......@@ -82,8 +82,8 @@ void UDRApiServer::init(size_t thr) {
auto opts = Pistache::Http::Endpoint::options().threads(thr);
opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxRequestSize(PISTACHE_SERVER_MAX_PAYLOAD);
// opts.maxRequestSize(PISTACHE_SERVER_MAX_REQUEST_SIZE);
// opts.maxResponseSize(PISTACHE_SERVER_MAX_RESPONSE_SIZE);
// opts.maxRequestSize(PISTACHE_SERVER_MAX_REQUEST_SIZE);
// opts.maxResponseSize(PISTACHE_SERVER_MAX_RESPONSE_SIZE);
m_httpEndpoint->init(opts);
m_authenticationSubscriptionDocumentApiserver->init();
......@@ -106,6 +106,4 @@ void UDRApiServer::start() {
}
//------------------------------------------------------------------------------
void UDRApiServer::shutdown() {
m_httpEndpoint->shutdown();
}
void UDRApiServer::shutdown() { m_httpEndpoint->shutdown(); }
......@@ -66,36 +66,39 @@ class UDRApiServer {
public:
UDRApiServer(Pistache::Address address, udr_app* udr_app_inst)
: m_httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(address)) {
m_router = std::make_shared<Pistache::Rest::Router>();
m_router = std::make_shared<Pistache::Rest::Router>();
m_address = address.host() + ":" + (address.port()).toString();
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 =
std::make_shared<AuthenticationStatusDocumentApiImpl>(m_router, udr_app_inst, m_address);
std::make_shared<AuthenticationStatusDocumentApiImpl>(
m_router, udr_app_inst, m_address);
m_accessAndMobilitySubscriptionDataDocumentApiserver =
std::make_shared<AccessAndMobilitySubscriptionDataDocumentApiImpl>(
m_router, udr_app_inst, m_address);
m_sMFSelectionSubscriptionDataDocumentApiserver =
std::make_shared<SMFSelectionSubscriptionDataDocumentApiImpl>(m_router,
udr_app_inst, m_address);
std::make_shared<SMFSelectionSubscriptionDataDocumentApiImpl>(
m_router, udr_app_inst, m_address);
m_sessionManagementSubscriptionDataApiserver =
std::make_shared<SessionManagementSubscriptionDataApiImpl>(m_router,
udr_app_inst, m_address);
std::make_shared<SessionManagementSubscriptionDataApiImpl>(
m_router, udr_app_inst, m_address);
m_aMF3GPPAccessRegistrationDocumentApiserver =
std::make_shared<AMF3GPPAccessRegistrationDocumentApiImpl>(m_router,
udr_app_inst, m_address);
std::make_shared<AMF3GPPAccessRegistrationDocumentApiImpl>(
m_router, udr_app_inst, m_address);
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 =
std::make_shared<SMFRegistrationsCollectionApiImpl>(m_router, udr_app_inst, m_address);
std::make_shared<SMFRegistrationsCollectionApiImpl>(
m_router, udr_app_inst, m_address);
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 =
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 start();
......
......@@ -290,5 +290,5 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
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)
This diff is collapsed.
......@@ -30,11 +30,21 @@
#ifndef FILE_UDR_APP_HPP_SEEN
#define FILE_UDR_APP_HPP_SEEN
#include <string>
#include <mysql/mysql.h>
#include <pistache/http.h>
#include <map>
#include <shared_mutex>
#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 udr {
......@@ -50,10 +60,94 @@ class udr_app {
virtual ~udr_app();
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);
private:
MYSQL mysql;
};
} // namespace app
} // 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