Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UDR
Commits
789c6c85
Commit
789c6c85
authored
Jun 21, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First running version for UDR
parent
8b6feda9
Changes
100
Hide whitespace changes
Inline
Side-by-side
Showing
100 changed files
with
2626 additions
and
2485 deletions
+2626
-2485
src/api_server/impl/AMF3GPPAccessRegistrationDocumentApiImpl.cpp
..._server/impl/AMF3GPPAccessRegistrationDocumentApiImpl.cpp
+14
-365
src/api_server/impl/AMF3GPPAccessRegistrationDocumentApiImpl.h
...pi_server/impl/AMF3GPPAccessRegistrationDocumentApiImpl.h
+6
-13
src/api_server/impl/AMFNon3GPPAccessRegistrationDocumentApiImpl.h
...server/impl/AMFNon3GPPAccessRegistrationDocumentApiImpl.h
+4
-6
src/api_server/impl/AccessAndMobilityDataApiImpl.h
src/api_server/impl/AccessAndMobilityDataApiImpl.h
+4
-6
src/api_server/impl/AccessAndMobilityPolicyDataDocumentApiImpl.h
..._server/impl/AccessAndMobilityPolicyDataDocumentApiImpl.h
+4
-6
src/api_server/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
...impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
+3
-267
src/api_server/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.h
...r/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.h
+6
-13
src/api_server/impl/AmfSubscriptionInfoDocumentApiImpl.h
src/api_server/impl/AmfSubscriptionInfoDocumentApiImpl.h
+4
-6
src/api_server/impl/ApplicationDataSubscriptionsCollectionApiImpl.h
...rver/impl/ApplicationDataSubscriptionsCollectionApiImpl.h
+3
-5
src/api_server/impl/AuthenticationSoRDocumentApiImpl.h
src/api_server/impl/AuthenticationSoRDocumentApiImpl.h
+4
-6
src/api_server/impl/AuthenticationStatusDocumentApiImpl.cpp
src/api_server/impl/AuthenticationStatusDocumentApiImpl.cpp
+18
-137
src/api_server/impl/AuthenticationStatusDocumentApiImpl.h
src/api_server/impl/AuthenticationStatusDocumentApiImpl.h
+6
-13
src/api_server/impl/AuthenticationSubscriptionDocumentApiImpl.cpp
...server/impl/AuthenticationSubscriptionDocumentApiImpl.cpp
+14
-153
src/api_server/impl/AuthenticationSubscriptionDocumentApiImpl.h
...i_server/impl/AuthenticationSubscriptionDocumentApiImpl.h
+6
-13
src/api_server/impl/AuthenticationUPUDocumentApiImpl.h
src/api_server/impl/AuthenticationUPUDocumentApiImpl.h
+4
-6
src/api_server/impl/BdtDataStoreApiImpl.h
src/api_server/impl/BdtDataStoreApiImpl.h
+4
-6
src/api_server/impl/BdtPolicyDataStoreApiImpl.h
src/api_server/impl/BdtPolicyDataStoreApiImpl.h
+4
-6
src/api_server/impl/CAGACKDocumentApiImpl.h
src/api_server/impl/CAGACKDocumentApiImpl.h
+4
-6
src/api_server/impl/CAGUpdateAckDocumentApiImpl.h
src/api_server/impl/CAGUpdateAckDocumentApiImpl.h
+4
-6
src/api_server/impl/Class5GVNGroupsInternalDocumentApiImpl.h
src/api_server/impl/Class5GVNGroupsInternalDocumentApiImpl.h
+4
-6
src/api_server/impl/Class5GVNGroupsStoreApiImpl.h
src/api_server/impl/Class5GVNGroupsStoreApiImpl.h
+4
-6
src/api_server/impl/Class5GVnGroupConfigurationDocumentApiImpl.h
..._server/impl/Class5GVnGroupConfigurationDocumentApiImpl.h
+4
-6
src/api_server/impl/ContextDataDocumentApiImpl.h
src/api_server/impl/ContextDataDocumentApiImpl.h
+3
-4
src/api_server/impl/Delete5GVnGroupApiImpl.h
src/api_server/impl/Delete5GVnGroupApiImpl.h
+3
-5
src/api_server/impl/EnhancedCoverageRestrictionDataApiImpl.h
src/api_server/impl/EnhancedCoverageRestrictionDataApiImpl.h
+4
-6
src/api_server/impl/EventAMFSubscriptionInfoDocumentApiImpl.h
...api_server/impl/EventAMFSubscriptionInfoDocumentApiImpl.h
+3
-5
src/api_server/impl/EventExposureDataDocumentApiImpl.h
src/api_server/impl/EventExposureDataDocumentApiImpl.h
+4
-6
src/api_server/impl/EventExposureGroupSubscriptionDocumentApiImpl.h
...rver/impl/EventExposureGroupSubscriptionDocumentApiImpl.h
+4
-5
src/api_server/impl/EventExposureGroupSubscriptionsCollectionApiImpl.h
...r/impl/EventExposureGroupSubscriptionsCollectionApiImpl.h
+4
-6
src/api_server/impl/EventExposureSubscriptionDocumentApiImpl.h
...pi_server/impl/EventExposureSubscriptionDocumentApiImpl.h
+4
-5
src/api_server/impl/EventExposureSubscriptionsCollectionApiImpl.h
...server/impl/EventExposureSubscriptionsCollectionApiImpl.h
+4
-6
src/api_server/impl/ExposureDataSubscriptionsCollectionApiImpl.h
..._server/impl/ExposureDataSubscriptionsCollectionApiImpl.h
+3
-5
src/api_server/impl/GroupIdentifiersApiImpl.h
src/api_server/impl/GroupIdentifiersApiImpl.h
+4
-6
src/api_server/impl/IPSMGWRegistrationDocumentApiImpl.h
src/api_server/impl/IPSMGWRegistrationDocumentApiImpl.h
+4
-6
src/api_server/impl/IPTVConfigurationDataStoreApiImpl.h
src/api_server/impl/IPTVConfigurationDataStoreApiImpl.h
+4
-6
src/api_server/impl/IndividualApplicationDataSubscriptionDocumentApiImpl.h
...pl/IndividualApplicationDataSubscriptionDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualAppliedBDTPolicyDataDocumentApiImpl.h
...rver/impl/IndividualAppliedBDTPolicyDataDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualBDTPolicyDataDocumentApiImpl.h
src/api_server/impl/IndividualBDTPolicyDataDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualBdtDataDocumentApiImpl.h
src/api_server/impl/IndividualBdtDataDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualExposureDataSubscriptionDocumentApiImpl.h
.../impl/IndividualExposureDataSubscriptionDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualIPTVConfigurationDataApiImpl.h
src/api_server/impl/IndividualIPTVConfigurationDataApiImpl.h
+4
-6
src/api_server/impl/IndividualIPTVConfigurationDataDocumentApiImpl.h
...ver/impl/IndividualIPTVConfigurationDataDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualInfluenceDataDocumentApiImpl.h
src/api_server/impl/IndividualInfluenceDataDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualInfluenceDataSubscriptionDocumentApiImpl.h
...impl/IndividualInfluenceDataSubscriptionDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualPFDDataDocumentApiImpl.h
src/api_server/impl/IndividualPFDDataDocumentApiImpl.h
+4
-6
src/api_server/impl/IndividualPolicyDataSubscriptionDocumentApiImpl.h
...er/impl/IndividualPolicyDataSubscriptionDocumentApiImpl.h
+4
-6
src/api_server/impl/InfluenceDataStoreApiImpl.h
src/api_server/impl/InfluenceDataStoreApiImpl.h
+4
-6
src/api_server/impl/InfluenceDataSubscriptionsCollectionApiImpl.h
...server/impl/InfluenceDataSubscriptionsCollectionApiImpl.h
+4
-6
src/api_server/impl/LCSBroadcastAssistanceSubscriptionDataApiImpl.h
...rver/impl/LCSBroadcastAssistanceSubscriptionDataApiImpl.h
+4
-6
src/api_server/impl/LCSMobileOriginatedSubscriptionDataApiImpl.h
..._server/impl/LCSMobileOriginatedSubscriptionDataApiImpl.h
+4
-6
src/api_server/impl/LCSPrivacySubscriptionDataApiImpl.h
src/api_server/impl/LCSPrivacySubscriptionDataApiImpl.h
+4
-6
src/api_server/impl/MessageWaitingDataDocumentApiImpl.h
src/api_server/impl/MessageWaitingDataDocumentApiImpl.h
+4
-6
src/api_server/impl/Modify5GVnGroupApiImpl.h
src/api_server/impl/Modify5GVnGroupApiImpl.h
+4
-6
src/api_server/impl/NSSAIACKDocumentApiImpl.h
src/api_server/impl/NSSAIACKDocumentApiImpl.h
+4
-6
src/api_server/impl/NSSAIUpdateAckDocumentApiImpl.h
src/api_server/impl/NSSAIUpdateAckDocumentApiImpl.h
+4
-6
src/api_server/impl/OperatorSpecificDataContainerDocumentApiImpl.h
...erver/impl/OperatorSpecificDataContainerDocumentApiImpl.h
+4
-6
src/api_server/impl/OperatorSpecificDataDocumentApiImpl.h
src/api_server/impl/OperatorSpecificDataDocumentApiImpl.h
+4
-6
src/api_server/impl/PFDDataStoreApiImpl.h
src/api_server/impl/PFDDataStoreApiImpl.h
+4
-6
src/api_server/impl/ParameterProvisionDocumentApiImpl.h
src/api_server/impl/ParameterProvisionDocumentApiImpl.h
+4
-6
src/api_server/impl/PduSessionManagementDataApiImpl.h
src/api_server/impl/PduSessionManagementDataApiImpl.h
+4
-6
src/api_server/impl/PlmnUePolicySetDocumentApiImpl.h
src/api_server/impl/PlmnUePolicySetDocumentApiImpl.h
+4
-6
src/api_server/impl/PolicyDataSubscriptionsCollectionApiImpl.h
...pi_server/impl/PolicyDataSubscriptionsCollectionApiImpl.h
+3
-5
src/api_server/impl/ProvisionedDataDocumentApiImpl.h
src/api_server/impl/ProvisionedDataDocumentApiImpl.h
+3
-4
src/api_server/impl/ProvisionedParameterDataDocumentApiImpl.h
...api_server/impl/ProvisionedParameterDataDocumentApiImpl.h
+4
-6
src/api_server/impl/Query5GVnGroupConfigurationDocumentApiImpl.h
..._server/impl/Query5GVnGroupConfigurationDocumentApiImpl.h
+4
-6
src/api_server/impl/QueryAMFSubscriptionInfoDocumentApiImpl.h
...api_server/impl/QueryAMFSubscriptionInfoDocumentApiImpl.h
+4
-6
src/api_server/impl/QueryIdentityDataBySUPIOrGPSIDocumentApiImpl.h
...erver/impl/QueryIdentityDataBySUPIOrGPSIDocumentApiImpl.h
+4
-6
src/api_server/impl/QueryNIDDAuthorizationDataGPSIOrExternalGroupIdentifierDocumentApiImpl.h
...izationDataGPSIOrExternalGroupIdentifierDocumentApiImpl.h
+4
-6
src/api_server/impl/QueryODBDataBySUPIOrGPSIDocumentApiImpl.h
...api_server/impl/QueryODBDataBySUPIOrGPSIDocumentApiImpl.h
+4
-6
src/api_server/impl/RetrievalOfSharedDataApiImpl.h
src/api_server/impl/RetrievalOfSharedDataApiImpl.h
+4
-5
src/api_server/impl/SDMSubscriptionDocumentApiImpl.cpp
src/api_server/impl/SDMSubscriptionDocumentApiImpl.cpp
+18
-241
src/api_server/impl/SDMSubscriptionDocumentApiImpl.h
src/api_server/impl/SDMSubscriptionDocumentApiImpl.h
+6
-13
src/api_server/impl/SDMSubscriptionsCollectionApiImpl.cpp
src/api_server/impl/SDMSubscriptionsCollectionApiImpl.cpp
+13
-206
src/api_server/impl/SDMSubscriptionsCollectionApiImpl.h
src/api_server/impl/SDMSubscriptionsCollectionApiImpl.h
+6
-14
src/api_server/impl/SMFRegistrationDocumentApiImpl.cpp
src/api_server/impl/SMFRegistrationDocumentApiImpl.cpp
+19
-249
src/api_server/impl/SMFRegistrationDocumentApiImpl.h
src/api_server/impl/SMFRegistrationDocumentApiImpl.h
+6
-14
src/api_server/impl/SMFRegistrationsCollectionApiImpl.cpp
src/api_server/impl/SMFRegistrationsCollectionApiImpl.cpp
+7
-108
src/api_server/impl/SMFRegistrationsCollectionApiImpl.h
src/api_server/impl/SMFRegistrationsCollectionApiImpl.h
+6
-14
src/api_server/impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
...rver/impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
+8
-58
src/api_server/impl/SMFSelectionSubscriptionDataDocumentApiImpl.h
...server/impl/SMFSelectionSubscriptionDataDocumentApiImpl.h
+6
-13
src/api_server/impl/SMSF3GPPRegistrationDocumentApiImpl.h
src/api_server/impl/SMSF3GPPRegistrationDocumentApiImpl.h
+4
-6
src/api_server/impl/SMSFNon3GPPRegistrationDocumentApiImpl.h
src/api_server/impl/SMSFNon3GPPRegistrationDocumentApiImpl.h
+4
-6
src/api_server/impl/SMSManagementSubscriptionDataDocumentApiImpl.h
...erver/impl/SMSManagementSubscriptionDataDocumentApiImpl.h
+4
-6
src/api_server/impl/SMSSubscriptionDataDocumentApiImpl.h
src/api_server/impl/SMSSubscriptionDataDocumentApiImpl.h
+4
-6
src/api_server/impl/SessionManagementPolicyDataDocumentApiImpl.h
..._server/impl/SessionManagementPolicyDataDocumentApiImpl.h
+4
-6
src/api_server/impl/SessionManagementSubscriptionDataApiImpl.cpp
..._server/impl/SessionManagementSubscriptionDataApiImpl.cpp
+14
-94
src/api_server/impl/SessionManagementSubscriptionDataApiImpl.h
...pi_server/impl/SessionManagementSubscriptionDataApiImpl.h
+6
-13
src/api_server/impl/SponsorConnectivityDataDocumentApiImpl.h
src/api_server/impl/SponsorConnectivityDataDocumentApiImpl.h
+4
-6
src/api_server/impl/SubsToNotifyCollectionApiImpl.h
src/api_server/impl/SubsToNotifyCollectionApiImpl.h
+4
-6
src/api_server/impl/SubsToNotifyDocumentApiImpl.h
src/api_server/impl/SubsToNotifyDocumentApiImpl.h
+4
-5
src/api_server/impl/TraceDataDocumentApiImpl.h
src/api_server/impl/TraceDataDocumentApiImpl.h
+4
-6
src/api_server/impl/UEPolicySetDocumentApiImpl.h
src/api_server/impl/UEPolicySetDocumentApiImpl.h
+4
-6
src/api_server/impl/UEsLocationInformationDocumentApiImpl.h
src/api_server/impl/UEsLocationInformationDocumentApiImpl.h
+4
-6
src/api_server/impl/UsageMonitoringInformationDocumentApiImpl.h
...i_server/impl/UsageMonitoringInformationDocumentApiImpl.h
+4
-6
src/api_server/impl/V2XSubscriptionDataApiImpl.h
src/api_server/impl/V2XSubscriptionDataApiImpl.h
+4
-6
src/api_server/udr-api-server.cpp
src/api_server/udr-api-server.cpp
+5
-7
src/api_server/udr-api-server.h
src/api_server/udr-api-server.h
+19
-16
src/oai_udr/CMakeLists.txt
src/oai_udr/CMakeLists.txt
+1
-1
src/udr_app/udr_app.cpp
src/udr_app/udr_app.cpp
+2023
-10
src/udr_app/udr_app.hpp
src/udr_app/udr_app.hpp
+97
-3
No files found.
src/api_server/impl/AMF3GPPAccessRegistrationDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -12,7 +12,6 @@
*/
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
...
...
@@ -26,12 +25,10 @@ using namespace oai::udr::model;
AMF3GPPAccessRegistrationDocumentApiImpl
::
AMF3GPPAccessRegistrationDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
udr_app
*
udr_app_inst
,
std
::
string
address
,
MYSQL
*
mysql
)
std
::
string
address
)
:
AMF3GPPAccessRegistrationDocumentApi
(
rtr
),
m_udr_app
(
udr_app_inst
),
m_address
(
address
)
{
mysql_WitcommUDRDB
=
mysql
;
}
m_address
(
address
)
{}
void
AMF3GPPAccessRegistrationDocumentApiImpl
::
amf_context3gpp
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
...
...
@@ -50,374 +47,26 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(
const
std
::
string
&
ueId
,
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_AMF3GPPAccessRegistration
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
ueId
+
"'"
;
std
::
string
query
;
nlohmann
::
json
j
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_AMF3GPPAccessRegistration
.
c_str
(),
(
unsigned
long
)
select_AMF3GPPAccessRegistration
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_AMF3GPPAccessRegistration
.
c_str
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_AMF3GPPAccessRegistration
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
query
=
"update Amf3GppAccessRegistration set amfInstanceId='"
+
amf3GppAccessRegistration
.
getAmfInstanceId
()
+
"'"
+
(
amf3GppAccessRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
amf3GppAccessRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
purgeFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isPurgeFlag
()
?
",purgeFlag=1"
:
",purgeFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
peiIsSet
()
?
",pei='"
+
amf3GppAccessRegistration
.
getPei
()
+
"'"
:
""
)
+
",deregCallbackUri='"
+
amf3GppAccessRegistration
.
getDeregCallbackUri
()
+
"'"
+
(
amf3GppAccessRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
amf3GppAccessRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
initialRegistrationIndIsSet
()
?
(
amf3GppAccessRegistration
.
isInitialRegistrationInd
()
?
",initialRegistrationInd=1"
:
",initialRegistrationInd=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
drFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isDrFlag
()
?
",drFlag=1"
:
",drFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
urrpIndicatorIsSet
()
?
(
amf3GppAccessRegistration
.
isUrrpIndicator
()
?
",urrpIndicator=1"
:
",urrpIndicator=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
amfEeSubscriptionIdIsSet
()
?
",amfEeSubscriptionId='"
+
amf3GppAccessRegistration
.
getAmfEeSubscriptionId
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
ueSrvccCapabilityIsSet
()
?
(
amf3GppAccessRegistration
.
isUeSrvccCapability
()
?
",ueSrvccCapability=1"
:
",ueSrvccCapability=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
amf3GppAccessRegistration
.
getRegistrationTime
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
noEeSubscriptionIndIsSet
()
?
(
amf3GppAccessRegistration
.
isNoEeSubscriptionInd
()
?
",noEeSubscriptionInd=1"
:
",noEeSubscriptionInd=0"
)
:
""
);
if
(
amf3GppAccessRegistration
.
imsVoPsIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getImsVoPs
());
query
+=
",imsVoPs='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNameDeregIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNameDereg
());
query
+=
",amfServiceNameDereg='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNamePcscfRestIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNamePcscfRest
());
query
+=
",amfServiceNamePcscfRest='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
backupAmfInfoIsSet
())
{
nlohmann
::
json
tmp
;
j
.
clear
();
std
::
vector
<
BackupAmfInfo
>
backupamfinfo
=
amf3GppAccessRegistration
.
getBackupAmfInfo
();
for
(
int
i
=
0
;
i
<
backupamfinfo
.
size
();
i
++
)
{
to_json
(
tmp
,
backupamfinfo
[
i
]);
j
+=
tmp
;
}
query
+=
",backupAmfInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
epsInterworkingInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getEpsInterworkingInfo
());
query
+=
",epsInterworkingInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
vgmlcAddressIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getVgmlcAddress
());
query
+=
",vgmlcAddress='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
amf3GppAccessRegistration
.
getGuami
());
query
+=
",guami='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
amf3GppAccessRegistration
.
getRatType
());
query
+=
",ratType='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"'"
;
}
else
{
query
=
"insert into Amf3GppAccessRegistration set ueid='"
+
ueId
+
"'"
+
",amfInstanceId='"
+
amf3GppAccessRegistration
.
getAmfInstanceId
()
+
"'"
+
(
amf3GppAccessRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
amf3GppAccessRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
purgeFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isPurgeFlag
()
?
",purgeFlag=1"
:
",purgeFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
peiIsSet
()
?
",pei='"
+
amf3GppAccessRegistration
.
getPei
()
+
"'"
:
""
)
+
",deregCallbackUri='"
+
amf3GppAccessRegistration
.
getDeregCallbackUri
()
+
"'"
+
(
amf3GppAccessRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
amf3GppAccessRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
initialRegistrationIndIsSet
()
?
(
amf3GppAccessRegistration
.
isInitialRegistrationInd
()
?
",initialRegistrationInd=1"
:
",initialRegistrationInd=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
drFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isDrFlag
()
?
",drFlag=1"
:
",drFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
urrpIndicatorIsSet
()
?
(
amf3GppAccessRegistration
.
isUrrpIndicator
()
?
",urrpIndicator=1"
:
",urrpIndicator=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
amfEeSubscriptionIdIsSet
()
?
",amfEeSubscriptionId='"
+
amf3GppAccessRegistration
.
getAmfEeSubscriptionId
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
ueSrvccCapabilityIsSet
()
?
(
amf3GppAccessRegistration
.
isUeSrvccCapability
()
?
",ueSrvccCapability=1"
:
",ueSrvccCapability=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
amf3GppAccessRegistration
.
getRegistrationTime
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
noEeSubscriptionIndIsSet
()
?
(
amf3GppAccessRegistration
.
isNoEeSubscriptionInd
()
?
",noEeSubscriptionInd=1"
:
",noEeSubscriptionInd=0"
)
:
""
);
if
(
amf3GppAccessRegistration
.
imsVoPsIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getImsVoPs
());
query
+=
",imsVoPs='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNameDeregIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNameDereg
());
query
+=
",amfServiceNameDereg='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNamePcscfRestIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNamePcscfRest
());
query
+=
",amfServiceNamePcscfRest='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
backupAmfInfoIsSet
())
{
nlohmann
::
json
tmp
;
j
.
clear
();
std
::
vector
<
BackupAmfInfo
>
backupamfinfo
=
amf3GppAccessRegistration
.
getBackupAmfInfo
();
for
(
int
i
=
0
;
i
<
backupamfinfo
.
size
();
i
++
)
{
to_json
(
tmp
,
backupamfinfo
[
i
]);
j
+=
tmp
;
}
query
+=
",backupAmfInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
epsInterworkingInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getEpsInterworkingInfo
());
query
+=
",epsInterworkingInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
vgmlcAddressIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getVgmlcAddress
());
query
+=
",vgmlcAddress='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
amf3GppAccessRegistration
.
getGuami
());
query
+=
",guami='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
amf3GppAccessRegistration
.
getRatType
());
query
+=
",ratType='"
+
j
.
dump
()
+
"'"
;
}
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_amf_3gpp_access_registration_document_create_amf_context
(
ueId
,
amf3GppAccessRegistration
,
response_data
,
code
);
mysql_free_result
(
res
);
// std::cout << query << std::endl;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
to_json
(
j
,
amf3GppAccessRegistration
);
response
.
send
(
Pistache
::
Http
::
Code
::
Created
,
j
.
dump
());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"Amf3GppAccessRegistration PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
Logger
::
udr_server
().
debug
(
"HTTP reponse code %d.
\n
"
,
code
);
response
.
send
(
code
,
response_data
.
dump
());
}
void
AMF3GPPAccessRegistrationDocumentApiImpl
::
query_amf_context3gpp
(
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
;
Amf3GppAccessRegistration
amf3gppaccessregistration
;
const
std
::
string
query
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"amfInstanceId"
,
field
->
name
))
{
amf3gppaccessregistration
.
setAmfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"purgeFlag"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setPurgeFlag
(
true
);
else
amf3gppaccessregistration
.
setPurgeFlag
(
false
);
}
else
if
(
!
strcmp
(
"pei"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setPei
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"imsVoPs"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ImsVoPs
imsvops
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
imsvops
);
amf3gppaccessregistration
.
setImsVoPs
(
imsvops
);
}
else
if
(
!
strcmp
(
"deregCallbackUri"
,
field
->
name
))
{
amf3gppaccessregistration
.
setDeregCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceNameDereg"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicenamedereg
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicenamedereg
);
amf3gppaccessregistration
.
setAmfServiceNameDereg
(
amfservicenamedereg
);
}
else
if
(
!
strcmp
(
"pcscfRestorationCallbackUri"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setPcscfRestorationCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceNamePcscfRest"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicenamepcscfrest
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicenamepcscfrest
);
amf3gppaccessregistration
.
setAmfServiceNamePcscfRest
(
amfservicenamepcscfrest
);
}
else
if
(
!
strcmp
(
"initialRegistrationInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setInitialRegistrationInd
(
true
);
else
amf3gppaccessregistration
.
setInitialRegistrationInd
(
false
);
}
else
if
(
!
strcmp
(
"guami"
,
field
->
name
))
{
Guami
guami
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
guami
);
amf3gppaccessregistration
.
setGuami
(
guami
);
}
else
if
(
!
strcmp
(
"backupAmfInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
BackupAmfInfo
>
backupamfinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
backupamfinfo
);
amf3gppaccessregistration
.
setBackupAmfInfo
(
backupamfinfo
);
}
else
if
(
!
strcmp
(
"drFlag"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setDrFlag
(
true
);
else
amf3gppaccessregistration
.
setDrFlag
(
false
);
}
else
if
(
!
strcmp
(
"ratType"
,
field
->
name
))
{
RatType
rattype
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
rattype
);
amf3gppaccessregistration
.
setRatType
(
rattype
);
}
else
if
(
!
strcmp
(
"urrpIndicator"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setUrrpIndicator
(
true
);
else
amf3gppaccessregistration
.
setUrrpIndicator
(
false
);
}
else
if
(
!
strcmp
(
"amfEeSubscriptionId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setAmfEeSubscriptionId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"epsInterworkingInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
EpsInterworkingInfo
epsinterworkinginfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
epsinterworkinginfo
);
amf3gppaccessregistration
.
setEpsInterworkingInfo
(
epsinterworkinginfo
);
}
else
if
(
!
strcmp
(
"ueSrvccCapability"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setUeSrvccCapability
(
true
);
else
amf3gppaccessregistration
.
setUeSrvccCapability
(
false
);
}
else
if
(
!
strcmp
(
"registrationTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setRegistrationTime
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"vgmlcAddress"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
VgmlcAddress
vgmlcaddress
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
vgmlcaddress
);
amf3gppaccessregistration
.
setVgmlcAddress
(
vgmlcaddress
);
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
amf3gppaccessregistration
.
setContextInfo
(
contextinfo
);
}
else
if
(
!
strcmp
(
"noEeSubscriptionInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setNoEeSubscriptionInd
(
true
);
else
amf3gppaccessregistration
.
setNoEeSubscriptionInd
(
false
);
}
}
to_json
(
j
,
amf3gppaccessregistration
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"Amf3GppAccessRegistration GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"Amf3GppAccessRegistration no data!SQL(%s)"
,
query
.
c_str
());
}
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_amf_3gpp_access_registration_document_query_amf_context
(
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
src/api_server/impl/AMF3GPPAccessRegistrationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/AMFNon3GPPAccessRegistrationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/AccessAndMobilityDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/AccessAndMobilityPolicyDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -12,6 +12,7 @@
*/
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include <nlohmann/json.hpp>
#include "logger.hpp"
...
...
@@ -26,12 +27,10 @@ using namespace oai::udr::model;
AccessAndMobilitySubscriptionDataDocumentApiImpl
::
AccessAndMobilitySubscriptionDataDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
udr_app
*
udr_app_inst
,
std
::
string
address
,
MYSQL
*
mysql
)
std
::
string
address
)
:
AccessAndMobilitySubscriptionDataDocumentApi
(
rtr
),
m_udr_app
(
udr_app_inst
),
m_address
(
address
)
{
mysql_WitcommUDRDB
=
mysql
;
}
m_address
(
address
)
{}
void
AccessAndMobilitySubscriptionDataDocumentApiImpl
::
query_am_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
...
...
@@ -47,269 +46,6 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(
Logger
::
udr_server
().
debug
(
"HTTP reponse code %d.
\n
"
,
code
);
response
.
send
(
code
,
response_data
.
dump
());
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
AccessAndMobilitySubscriptionData
accessandmobilitysubscriptiondata
;
const
std
::
string
query
=
"select * from AccessAndMobilitySubscriptionData WHERE ueid='"
+
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!"
);
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!"
);
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"gpsis"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
gpsis
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
gpsis
);
accessandmobilitysubscriptiondata
.
setGpsis
(
gpsis
);
}
else
if
(
!
strcmp
(
"internalGroupIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
internalgroupids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
internalgroupids
);
accessandmobilitysubscriptiondata
.
setInternalGroupIds
(
internalgroupids
);
}
else
if
(
!
strcmp
(
"sharedVnGroupDataIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
std
::
string
>
sharedvngroupdataids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sharedvngroupdataids
);
accessandmobilitysubscriptiondata
.
setSharedVnGroupDataIds
(
sharedvngroupdataids
);
}
else
if
(
!
strcmp
(
"subscribedUeAmbr"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
AmbrRm
subscribedueambr
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
subscribedueambr
);
accessandmobilitysubscriptiondata
.
setSubscribedUeAmbr
(
subscribedueambr
);
}
else
if
(
!
strcmp
(
"nssai"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
Nssai
nssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
nssai
);
accessandmobilitysubscriptiondata
.
setNssai
(
nssai
);
}
else
if
(
!
strcmp
(
"ratRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
RatType
>
ratrestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
ratrestrictions
);
accessandmobilitysubscriptiondata
.
setRatRestrictions
(
ratrestrictions
);
}
else
if
(
!
strcmp
(
"forbiddenAreas"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
Area
>
forbiddenareas
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
forbiddenareas
);
accessandmobilitysubscriptiondata
.
setForbiddenAreas
(
forbiddenareas
);
}
else
if
(
!
strcmp
(
"serviceAreaRestriction"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceAreaRestriction
servicearearestriction
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
servicearearestriction
);
accessandmobilitysubscriptiondata
.
setServiceAreaRestriction
(
servicearearestriction
);
}
else
if
(
!
strcmp
(
"coreNetworkTypeRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
CoreNetworkType
>
corenetworktyperestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
corenetworktyperestrictions
);
accessandmobilitysubscriptiondata
.
setCoreNetworkTypeRestrictions
(
corenetworktyperestrictions
);
}
else
if
(
!
strcmp
(
"rfspIndex"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setRfspIndex
(
a
);
}
else
if
(
!
strcmp
(
"subsRegTimer"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setSubsRegTimer
(
a
);
}
else
if
(
!
strcmp
(
"ueUsageType"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setUeUsageType
(
a
);
}
else
if
(
!
strcmp
(
"mpsPriority"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setMpsPriority
(
true
);
else
accessandmobilitysubscriptiondata
.
setMpsPriority
(
false
);
}
else
if
(
!
strcmp
(
"mcsPriority"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setMcsPriority
(
true
);
else
accessandmobilitysubscriptiondata
.
setMcsPriority
(
false
);
}
else
if
(
!
strcmp
(
"activeTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setActiveTime
(
a
);
}
else
if
(
!
strcmp
(
"sorInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SorInfo
sorinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sorinfo
);
accessandmobilitysubscriptiondata
.
setSorInfo
(
sorinfo
);
}
else
if
(
!
strcmp
(
"sorInfoExpectInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setSorInfoExpectInd
(
true
);
else
accessandmobilitysubscriptiondata
.
setSorInfoExpectInd
(
false
);
}
else
if
(
!
strcmp
(
"sorafRetrieval"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setSorafRetrieval
(
true
);
else
accessandmobilitysubscriptiondata
.
setSorafRetrieval
(
false
);
}
else
if
(
!
strcmp
(
"sorUpdateIndicatorList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
SorUpdateIndicator
>
sorupdateindicatorlist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sorupdateindicatorlist
);
accessandmobilitysubscriptiondata
.
setSorUpdateIndicatorList
(
sorupdateindicatorlist
);
}
else
if
(
!
strcmp
(
"upuInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
UpuInfo
upuinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
upuinfo
);
accessandmobilitysubscriptiondata
.
setUpuInfo
(
upuinfo
);
}
else
if
(
!
strcmp
(
"micoAllowed"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setMicoAllowed
(
true
);
else
accessandmobilitysubscriptiondata
.
setMicoAllowed
(
false
);
}
else
if
(
!
strcmp
(
"sharedAmDataIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
sharedamdataids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sharedamdataids
);
accessandmobilitysubscriptiondata
.
setSharedAmDataIds
(
sharedamdataids
);
}
else
if
(
!
strcmp
(
"odbPacketServices"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
OdbPacketServices
odbpacketservices
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
odbpacketservices
);
accessandmobilitysubscriptiondata
.
setOdbPacketServices
(
odbpacketservices
);
}
else
if
(
!
strcmp
(
"serviceGapTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setServiceGapTime
(
a
);
}
else
if
(
!
strcmp
(
"mdtUserConsent"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
MdtUserConsent
mdtuserconsent
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
mdtuserconsent
);
accessandmobilitysubscriptiondata
.
setMdtUserConsent
(
mdtuserconsent
);
}
else
if
(
!
strcmp
(
"mdtConfiguration"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
MdtConfiguration
mdtconfiguration
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
mdtconfiguration
);
accessandmobilitysubscriptiondata
.
setMdtConfiguration
(
mdtconfiguration
);
}
else
if
(
!
strcmp
(
"traceData"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
TraceData
tracedata
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
tracedata
);
accessandmobilitysubscriptiondata
.
setTraceData
(
tracedata
);
}
else
if
(
!
strcmp
(
"cagData"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
CagData
cagdata
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
cagdata
);
accessandmobilitysubscriptiondata
.
setCagData
(
cagdata
);
}
else
if
(
!
strcmp
(
"stnSr"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setStnSr
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"cMsisdn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setCMsisdn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"nbIoTUePriority"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setNbIoTUePriority
(
a
);
}
else
if
(
!
strcmp
(
"nssaiInclusionAllowed"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setNssaiInclusionAllowed
(
true
);
else
accessandmobilitysubscriptiondata
.
setNssaiInclusionAllowed
(
false
);
}
else
if
(
!
strcmp
(
"rgWirelineCharacteristics"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setRgWirelineCharacteristics
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"ecRestrictionDataWb"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
EcRestrictionDataWb
ecrestrictiondatawb
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
ecrestrictiondatawb
);
accessandmobilitysubscriptiondata
.
setEcRestrictionDataWb
(
ecrestrictiondatawb
);
}
else
if
(
!
strcmp
(
"ecRestrictionDataNb"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setEcRestrictionDataNb
(
true
);
else
accessandmobilitysubscriptiondata
.
setEcRestrictionDataNb
(
false
);
}
else
if
(
!
strcmp
(
"expectedUeBehaviourList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ExpectedUeBehaviourData
expecteduebehaviourlist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
expecteduebehaviourlist
);
accessandmobilitysubscriptiondata
.
setExpectedUeBehaviourList
(
expecteduebehaviourlist
);
}
else
if
(
!
strcmp
(
"primaryRatRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
RatType
>
primaryratrestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
primaryratrestrictions
);
accessandmobilitysubscriptiondata
.
setPrimaryRatRestrictions
(
primaryratrestrictions
);
}
else
if
(
!
strcmp
(
"secondaryRatRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
RatType
>
secondaryratrestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
secondaryratrestrictions
);
accessandmobilitysubscriptiondata
.
setSecondaryRatRestrictions
(
secondaryratrestrictions
);
}
else
if
(
!
strcmp
(
"edrxParametersList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
EdrxParameters
>
edrxparameterslist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
edrxparameterslist
);
accessandmobilitysubscriptiondata
.
setEdrxParametersList
(
edrxparameterslist
);
}
else
if
(
!
strcmp
(
"ptwParametersList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
PtwParameters
>
ptwparameterslist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
ptwparameterslist
);
accessandmobilitysubscriptiondata
.
setPtwParametersList
(
ptwparameterslist
);
}
else
if
(
!
strcmp
(
"iabOperationAllowed"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setIabOperationAllowed
(
true
);
else
accessandmobilitysubscriptiondata
.
setIabOperationAllowed
(
false
);
}
else
if
(
!
strcmp
(
"wirelineForbiddenAreas"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
WirelineArea
>
wirelineforbiddenareas
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
wirelineforbiddenareas
);
accessandmobilitysubscriptiondata
.
setWirelineForbiddenAreas
(
wirelineforbiddenareas
);
}
else
if
(
!
strcmp
(
"wirelineServiceAreaRestriction"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
WirelineServiceAreaRestriction
wirelineservicearearestriction
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
wirelineservicearearestriction
);
accessandmobilitysubscriptiondata
.
setWirelineServiceAreaRestriction
(
wirelineservicearearestriction
);
}
}
to_json
(
j
,
accessandmobilitysubscriptiondata
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"AccessAndMobilitySubscriptionData GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"AccessAndMobilitySubscriptionData no data!"
);
}
mysql_free_result
(
res
);
}
}
// namespace oai::udr::api
src/api_server/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/AmfSubscriptionInfoDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/ApplicationDataSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/AuthenticationSoRDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/AuthenticationStatusDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/AuthenticationStatusDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/AuthenticationSubscriptionDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/AuthenticationSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/AuthenticationUPUDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/BdtDataStoreApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/BdtPolicyDataStoreApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/CAGACKDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/CAGUpdateAckDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/Class5GVNGroupsInternalDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/Class5GVNGroupsStoreApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/Class5GVnGroupConfigurationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/ContextDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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"
...
...
src/api_server/impl/Delete5GVnGroupApiImpl.h
View file @
789c6c85
...
...
@@ -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"
...
...
src/api_server/impl/EnhancedCoverageRestrictionDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/EventAMFSubscriptionInfoDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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"
...
...
src/api_server/impl/EventExposureDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/EventExposureGroupSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/EventExposureGroupSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/EventExposureSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/EventExposureSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/ExposureDataSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/GroupIdentifiersApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IPSMGWRegistrationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IPTVConfigurationDataStoreApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualApplicationDataSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualAppliedBDTPolicyDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualBDTPolicyDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualBdtDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualExposureDataSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualIPTVConfigurationDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualIPTVConfigurationDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualInfluenceDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualInfluenceDataSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualPFDDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/IndividualPolicyDataSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/InfluenceDataStoreApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/InfluenceDataSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/LCSBroadcastAssistanceSubscriptionDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/LCSMobileOriginatedSubscriptionDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/LCSPrivacySubscriptionDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/MessageWaitingDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/Modify5GVnGroupApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/NSSAIACKDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/NSSAIUpdateAckDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/OperatorSpecificDataContainerDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/OperatorSpecificDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/PFDDataStoreApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/ParameterProvisionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/PduSessionManagementDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/PlmnUePolicySetDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/PolicyDataSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/ProvisionedDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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"
...
...
src/api_server/impl/ProvisionedParameterDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/Query5GVnGroupConfigurationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/QueryAMFSubscriptionInfoDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/QueryIdentityDataBySUPIOrGPSIDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/QueryNIDDAuthorizationDataGPSIOrExternalGroupIdentifierDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/QueryODBDataBySUPIOrGPSIDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/RetrievalOfSharedDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SDMSubscriptionDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -12,7 +12,6 @@
*/
#include "SDMSubscriptionDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
...
...
@@ -25,12 +24,10 @@ using namespace oai::udr::model;
SDMSubscriptionDocumentApiImpl
::
SDMSubscriptionDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
udr_app
*
udr_app_inst
,
std
::
string
address
,
MYSQL
*
mysql
)
std
::
string
address
)
:
SDMSubscriptionDocumentApi
(
rtr
),
m_udr_app
(
udr_app_inst
),
m_address
(
address
)
{
mysql_WitcommUDRDB
=
mysql
;
}
m_address
(
address
)
{}
void
SDMSubscriptionDocumentApiImpl
::
modifysdm_subscription
(
const
std
::
string
&
ueId
,
const
std
::
string
&
subsId
,
...
...
@@ -42,254 +39,34 @@ void SDMSubscriptionDocumentApiImpl::modifysdm_subscription(
void
SDMSubscriptionDocumentApiImpl
::
querysdm_subscription
(
const
std
::
string
&
ueId
,
const
std
::
string
&
subsId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
SdmSubscription
SdmSubscriptions
;
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_query_sdm_subscription
(
ueId
,
subsId
,
response_data
,
code
);
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"nfInstanceId"
,
field
->
name
))
{
SdmSubscriptions
.
setNfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"implicitUnsubscribe"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
SdmSubscriptions
.
setImplicitUnsubscribe
(
true
);
else
SdmSubscriptions
.
setImplicitUnsubscribe
(
false
);
}
else
if
(
!
strcmp
(
"expires"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setExpires
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"callbackReference"
,
field
->
name
))
{
SdmSubscriptions
.
setCallbackReference
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceName"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicename
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicename
);
SdmSubscriptions
.
setAmfServiceName
(
amfservicename
);
}
else
if
(
!
strcmp
(
"monitoredResourceUris"
,
field
->
name
))
{
std
::
vector
<
std
::
string
>
monitoredresourceuris
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
monitoredresourceuris
);
SdmSubscriptions
.
setMonitoredResourceUris
(
monitoredresourceuris
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
SdmSubscriptions
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setDnn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"subscriptionId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setSubscriptionId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"plmnId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
SdmSubscriptions
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"immediateReport"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
SdmSubscriptions
.
setImmediateReport
(
true
);
else
SdmSubscriptions
.
setImmediateReport
(
false
);
}
else
if
(
!
strcmp
(
"report"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SubscriptionDataSets
report
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
report
);
SdmSubscriptions
.
setReport
(
report
);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
SdmSubscriptions
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
j
,
SdmSubscriptions
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SdmSubscription GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"SdmSubscription no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
Logger
::
udr_server
().
debug
(
"HTTP reponse code %d.
\n
"
,
code
);
response
.
send
(
code
,
response_data
.
dump
());
}
void
SDMSubscriptionDocumentApiImpl
::
removesdm_subscriptions
(
const
std
::
string
&
ueId
,
const
std
::
string
&
subsId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
nlohmann
::
json
j
;
ProblemDetails
problemdetails
;
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
const
std
::
string
query
=
"DELETE from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_query
.
c_str
(),
(
unsigned
long
)
select_query
.
size
()))
{
problemdetails
.
setCause
(
"USER_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
j
.
dump
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
problemdetails
.
setCause
(
"USER_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
j
.
dump
());
return
;
}
if
(
!
mysql_num_rows
(
res
))
{
problemdetails
.
setCause
(
"DATA_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
j
.
dump
());
return
;
}
mysql_free_result
(
res
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
problemdetails
.
setCause
(
"USER_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
j
.
dump
());
return
;
}
response
.
send
(
Pistache
::
Http
::
Code
::
No_Content
,
""
);
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_remove_sdm_subscription
(
ueId
,
subsId
,
response_data
,
code
);
Logger
::
udr_server
().
debug
(
"SdmSubscription DELETE - successful"
);
Logger
::
udr_server
().
debug
(
"HTTP reponse code %d.
\n
"
,
code
);
response
.
send
(
code
,
response_data
.
dump
());
}
void
SDMSubscriptionDocumentApiImpl
::
updatesdmsubscriptions
(
const
std
::
string
&
ueId
,
const
std
::
string
&
subsId
,
SdmSubscription
&
sdmSubscription
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
std
::
string
query
;
nlohmann
::
json
j
;
ProblemDetails
problemdetails
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_query
.
c_str
(),
(
unsigned
long
)
select_query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
nlohmann
::
json
MonitoredResourceUris_json
(
sdmSubscription
.
getMonitoredResourceUris
());
query
=
"update SdmSubscriptions set nfInstanceId='"
+
sdmSubscription
.
getNfInstanceId
()
+
"'"
+
(
sdmSubscription
.
implicitUnsubscribeIsSet
()
?
(
sdmSubscription
.
isImplicitUnsubscribe
()
?
",implicitUnsubscribe=1"
:
",implicitUnsubscribe=0"
)
:
""
)
+
(
sdmSubscription
.
expiresIsSet
()
?
",expires='"
+
sdmSubscription
.
getExpires
()
+
"'"
:
""
)
+
",callbackReference='"
+
sdmSubscription
.
getCallbackReference
()
+
"'"
+
(
sdmSubscription
.
dnnIsSet
()
?
",dnn='"
+
sdmSubscription
.
getDnn
()
+
"'"
:
""
)
+
(
sdmSubscription
.
subscriptionIdIsSet
()
?
",subscriptionId='"
+
sdmSubscription
.
getSubscriptionId
()
+
"'"
:
""
)
+
(
sdmSubscription
.
immediateReportIsSet
()
?
(
sdmSubscription
.
isImmediateReport
()
?
",immediateReport=1"
:
",immediateReport=0"
)
:
""
)
+
(
sdmSubscription
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
sdmSubscription
.
getSupportedFeatures
()
+
"'"
:
""
);
if
(
sdmSubscription
.
amfServiceNameIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getAmfServiceName
());
query
+=
",amfServiceName='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
singleNssaiIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
plmnIdIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
reportIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getReport
());
query
+=
",report='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
contextInfoIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
query
+=
",monitoredResourceUris='"
+
MonitoredResourceUris_json
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
}
else
{
to_json
(
j
,
problemdetails
);
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
j
.
dump
());
mysql_free_result
(
res
);
return
;
}
mysql_free_result
(
res
);
// std::cout << query << std::endl;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
response
.
send
(
Pistache
::
Http
::
Code
::
No_Content
,
""
);
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_update_sdm_subscription
(
ueId
,
subsId
,
sdmSubscription
,
response_data
,
code
);
to_json
(
j
,
sdmSubscription
);
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SdmSubscription PUT - 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
src/api_server/impl/SDMSubscriptionDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SDMSubscriptionsCollectionApiImpl.cpp
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SDMSubscriptionsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SMFRegistrationDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -12,7 +12,6 @@
*/
#include "SMFRegistrationDocumentApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
#include "udr_app.hpp"
...
...
@@ -25,274 +24,45 @@ using namespace oai::udr::model;
SMFRegistrationDocumentApiImpl
::
SMFRegistrationDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
udr_app
*
udr_app_inst
,
std
::
string
address
,
MYSQL
*
mysql
)
std
::
string
address
)
:
SMFRegistrationDocumentApi
(
rtr
),
m_udr_app
(
udr_app_inst
),
m_address
(
address
)
{
mysql_WitcommUDRDB
=
mysql
;
}
m_address
(
address
)
{}
void
SMFRegistrationDocumentApiImpl
::
create_smf_context_non3gpp
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
const
SmfRegistration
&
smfRegistration
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_SmfRegistration
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
std
::
string
query
;
nlohmann
::
json
j
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_SmfRegistration
.
c_str
(),
(
unsigned
long
)
select_SmfRegistration
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_SmfRegistration
.
c_str
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_SmfRegistration
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
query
=
"update SmfRegistrations set smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"'"
+
",pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
(
smfRegistration
.
smfSetIdIsSet
()
?
",smfSetId='"
+
smfRegistration
.
getSmfSetId
()
+
"'"
:
""
)
+
(
smfRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
smfRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
smfRegistration
.
dnnIsSet
()
?
",dnn='"
+
smfRegistration
.
getDnn
()
+
"'"
:
""
)
+
(
smfRegistration
.
emergencyServicesIsSet
()
?
(
smfRegistration
.
isEmergencyServices
()
?
",emergencyServices=1"
:
",emergencyServices=0"
)
:
""
)
+
(
smfRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
smfRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
pgwFqdnIsSet
()
?
",pgwFqdn='"
+
smfRegistration
.
getPgwFqdn
()
+
"'"
:
""
)
+
(
smfRegistration
.
epdgIndIsSet
()
?
(
smfRegistration
.
isEpdgInd
()
?
",epdgInd=1"
:
",epdgInd=0"
)
:
""
)
+
(
smfRegistration
.
deregCallbackUriIsSet
()
?
",deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
smfRegistration
.
getRegistrationTime
()
+
"'"
:
""
);
if
(
smfRegistration
.
registrationReasonIsSet
())
{
to_json
(
j
,
smfRegistration
.
getRegistrationReason
());
query
+=
",registrationReason='"
+
j
.
dump
()
+
"'"
;
}
if
(
smfRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
smfRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
smfRegistration
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
}
else
{
query
=
"insert into SmfRegistrations set ueid='"
+
ueId
+
"'"
+
",subpduSessionId="
+
std
::
to_string
(
pduSessionId
)
+
",pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
",smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"'"
+
(
smfRegistration
.
smfSetIdIsSet
()
?
",smfSetId='"
+
smfRegistration
.
getSmfSetId
()
+
"'"
:
""
)
+
(
smfRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
smfRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
smfRegistration
.
dnnIsSet
()
?
",dnn='"
+
smfRegistration
.
getDnn
()
+
"'"
:
""
)
+
(
smfRegistration
.
emergencyServicesIsSet
()
?
(
smfRegistration
.
isEmergencyServices
()
?
",emergencyServices=1"
:
",emergencyServices=0"
)
:
""
)
+
(
smfRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
smfRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
pgwFqdnIsSet
()
?
",pgwFqdn='"
+
smfRegistration
.
getPgwFqdn
()
+
"'"
:
""
)
+
(
smfRegistration
.
epdgIndIsSet
()
?
(
smfRegistration
.
isEpdgInd
()
?
",epdgInd=1"
:
",epdgInd=0"
)
:
""
)
+
(
smfRegistration
.
deregCallbackUriIsSet
()
?
",deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
smfRegistration
.
getRegistrationTime
()
+
"'"
:
""
);
if
(
smfRegistration
.
registrationReasonIsSet
())
{
to_json
(
j
,
smfRegistration
.
getRegistrationReason
());
query
+=
",registrationReason='"
+
j
.
dump
()
+
"'"
;
}
if
(
smfRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
smfRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
smfRegistration
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
}
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_create_smf_context_non_3gpp
(
ueId
,
pduSessionId
,
smfRegistration
,
response_data
,
code
);
mysql_free_result
(
res
);
// std::cout << query << std::endl;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
to_json
(
j
,
smfRegistration
);
response
.
send
(
Pistache
::
Http
::
Code
::
Created
,
j
.
dump
());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SmfRegistration PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
Logger
::
udr_server
().
debug
(
"HTTP reponse code %d.
\n
"
,
code
);
response
.
send
(
code
,
response_data
.
dump
());
}
void
SMFRegistrationDocumentApiImpl
::
delete_smf_context
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
const
std
::
string
query
=
"DELETE from SmfRegistrations WHERE ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_delete_smf_context
(
ueId
,
pduSessionId
,
response_data
,
code
);
response
.
send
(
Pistache
::
Http
::
Code
::
No_Content
,
""
);
Logger
::
udr_server
().
debug
(
"SmfRegistration DELETE - successful"
);
Logger
::
udr_server
().
debug
(
"HTTP reponse code %d.
\n
"
,
code
);
response
.
send
(
code
,
response_data
.
dump
()
);
}
void
SMFRegistrationDocumentApiImpl
::
query_smf_registration
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
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
;
SmfRegistration
smfregistration
;
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"smfInstanceId"
,
field
->
name
))
{
smfregistration
.
setSmfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"smfSetId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setSmfSetId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"pduSessionId"
,
field
->
name
))
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
smfregistration
.
setPduSessionId
(
a
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
))
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
smfregistration
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setDnn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"emergencyServices"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
smfregistration
.
setEmergencyServices
(
true
);
else
smfregistration
.
setEmergencyServices
(
false
);
}
else
if
(
!
strcmp
(
"pcscfRestorationCallbackUri"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setPcscfRestorationCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"plmnId"
,
field
->
name
))
{
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
smfregistration
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"pgwFqdn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setPgwFqdn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"epdgInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
smfregistration
.
setEpdgInd
(
true
);
else
smfregistration
.
setEpdgInd
(
false
);
}
else
if
(
!
strcmp
(
"deregCallbackUri"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setDeregCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"registrationReason"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
RegistrationReason
registrationreason
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
registrationreason
);
smfregistration
.
setRegistrationReason
(
registrationreason
);
}
else
if
(
!
strcmp
(
"registrationTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setRegistrationTime
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
smfregistration
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
j
,
smfregistration
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SmfRegistration GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"SmfRegistration no data!SQL(%s)"
,
query
.
c_str
());
}
nlohmann
::
json
response_data
=
{};
Pistache
::
Http
::
Code
code
=
{};
m_udr_app
->
handle_query_smf_registration
(
ueId
,
pduSessionId
,
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
src/api_server/impl/SMFRegistrationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SMFRegistrationsCollectionApiImpl.cpp
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SMFRegistrationsCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SMFSelectionSubscriptionDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SMSF3GPPRegistrationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SMSFNon3GPPRegistrationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SMSManagementSubscriptionDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SMSSubscriptionDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SessionManagementPolicyDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SessionManagementSubscriptionDataApiImpl.cpp
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SessionManagementSubscriptionDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
src/api_server/impl/SponsorConnectivityDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SubsToNotifyCollectionApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/SubsToNotifyDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/TraceDataDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/UEPolicySetDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/UEsLocationInformationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/UsageMonitoringInformationDocumentApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/impl/V2XSubscriptionDataApiImpl.h
View file @
789c6c85
...
...
@@ -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
{
...
...
src/api_server/udr-api-server.cpp
View file @
789c6c85
...
...
@@ -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
();
}
src/api_server/udr-api-server.h
View file @
789c6c85
...
...
@@ -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
();
...
...
src/oai_udr/CMakeLists.txt
View file @
789c6c85
...
...
@@ -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
)
src/udr_app/udr_app.cpp
View file @
789c6c85
...
...
@@ -28,7 +28,7 @@
*/
#include "udr_app.hpp"
#include <mysql/mysql.h>
#include <unistd.h>
#include <boost/algorithm/string.hpp>
...
...
@@ -40,34 +40,2047 @@
#include <boost/uuid/uuid_io.hpp>
#include <chrono>
#include "AccessAndMobilitySubscriptionData.h"
#include "AuthenticationSubscription.h"
#include "ProblemDetails.h"
#include "SequenceNumber.h"
#include "logger.hpp"
#include "udr_config.hpp"
using
namespace
oai
::
udr
::
app
;
using
namespace
oai
::
udr
::
model
;
using
namespace
std
::
chrono
;
using
namespace
config
;
extern
udr_app
*
udr_app_inst
;
extern
udr_app
*
udr_app_inst
;
extern
udr_config
udr_cfg
;
//------------------------------------------------------------------------------
udr_app
::
udr_app
(
const
std
::
string
&
config_file
)
{
udr_app
::
udr_app
(
const
std
::
string
&
config_file
)
{
Logger
::
udr_app
().
startup
(
"Starting..."
);
mysql_init
(
&
mysql
);
if
(
!
mysql_real_connect
(
&
mysql
,
udr_cfg
.
mysql
.
mysql_server
.
c_str
(),
udr_cfg
.
mysql
.
mysql_user
.
c_str
(),
udr_cfg
.
mysql
.
mysql_pass
.
c_str
(),
udr_cfg
.
mysql
.
mysql_db
.
c_str
(),
0
,
0
,
0
))
{
Logger
::
udr_app
().
error
(
"An error occurred while connecting to db: %s"
,
mysql_error
(
&
mysql
));
}
// TODO: Register to NRF
Logger
::
udr_app
().
startup
(
"Started"
);
}
//------------------------------------------------------------------------------
udr_app
::~
udr_app
()
{
Logger
::
udr_app
().
debug
(
"Delete UDM APP instance..."
);
}
udr_app
::~
udr_app
()
{
Logger
::
udr_app
().
debug
(
"Delete UDM APP instance..."
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_access_mobility_subscription_data_document
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
oai
::
udr
::
model
::
AccessAndMobilitySubscriptionData
accessandmobilitysubscriptiondata
;
const
std
::
string
query
=
"select * from AccessAndMobilitySubscriptionData WHERE ueid='"
+
ue_id
+
"' and servingPlmnid='"
+
serving_plmn_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!"
);
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!"
);
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"gpsis"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
gpsis
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
gpsis
);
accessandmobilitysubscriptiondata
.
setGpsis
(
gpsis
);
}
else
if
(
!
strcmp
(
"internalGroupIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
internalgroupids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
internalgroupids
);
accessandmobilitysubscriptiondata
.
setInternalGroupIds
(
internalgroupids
);
}
else
if
(
!
strcmp
(
"sharedVnGroupDataIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
std
::
string
>
sharedvngroupdataids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sharedvngroupdataids
);
accessandmobilitysubscriptiondata
.
setSharedVnGroupDataIds
(
sharedvngroupdataids
);
}
else
if
(
!
strcmp
(
"subscribedUeAmbr"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
AmbrRm
subscribedueambr
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
subscribedueambr
);
accessandmobilitysubscriptiondata
.
setSubscribedUeAmbr
(
subscribedueambr
);
}
else
if
(
!
strcmp
(
"nssai"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
Nssai
nssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
nssai
);
accessandmobilitysubscriptiondata
.
setNssai
(
nssai
);
}
else
if
(
!
strcmp
(
"ratRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
RatType
>
ratrestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
ratrestrictions
);
accessandmobilitysubscriptiondata
.
setRatRestrictions
(
ratrestrictions
);
}
else
if
(
!
strcmp
(
"forbiddenAreas"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
Area
>
forbiddenareas
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
forbiddenareas
);
accessandmobilitysubscriptiondata
.
setForbiddenAreas
(
forbiddenareas
);
}
else
if
(
!
strcmp
(
"serviceAreaRestriction"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceAreaRestriction
servicearearestriction
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
servicearearestriction
);
accessandmobilitysubscriptiondata
.
setServiceAreaRestriction
(
servicearearestriction
);
}
else
if
(
!
strcmp
(
"coreNetworkTypeRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
CoreNetworkType
>
corenetworktyperestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
corenetworktyperestrictions
);
accessandmobilitysubscriptiondata
.
setCoreNetworkTypeRestrictions
(
corenetworktyperestrictions
);
}
else
if
(
!
strcmp
(
"rfspIndex"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setRfspIndex
(
a
);
}
else
if
(
!
strcmp
(
"subsRegTimer"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setSubsRegTimer
(
a
);
}
else
if
(
!
strcmp
(
"ueUsageType"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setUeUsageType
(
a
);
}
else
if
(
!
strcmp
(
"mpsPriority"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setMpsPriority
(
true
);
else
accessandmobilitysubscriptiondata
.
setMpsPriority
(
false
);
}
else
if
(
!
strcmp
(
"mcsPriority"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setMcsPriority
(
true
);
else
accessandmobilitysubscriptiondata
.
setMcsPriority
(
false
);
}
else
if
(
!
strcmp
(
"activeTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setActiveTime
(
a
);
}
else
if
(
!
strcmp
(
"sorInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SorInfo
sorinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sorinfo
);
accessandmobilitysubscriptiondata
.
setSorInfo
(
sorinfo
);
}
else
if
(
!
strcmp
(
"sorInfoExpectInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setSorInfoExpectInd
(
true
);
else
accessandmobilitysubscriptiondata
.
setSorInfoExpectInd
(
false
);
}
else
if
(
!
strcmp
(
"sorafRetrieval"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setSorafRetrieval
(
true
);
else
accessandmobilitysubscriptiondata
.
setSorafRetrieval
(
false
);
}
else
if
(
!
strcmp
(
"sorUpdateIndicatorList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
SorUpdateIndicator
>
sorupdateindicatorlist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sorupdateindicatorlist
);
accessandmobilitysubscriptiondata
.
setSorUpdateIndicatorList
(
sorupdateindicatorlist
);
}
else
if
(
!
strcmp
(
"upuInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
UpuInfo
upuinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
upuinfo
);
accessandmobilitysubscriptiondata
.
setUpuInfo
(
upuinfo
);
}
else
if
(
!
strcmp
(
"micoAllowed"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setMicoAllowed
(
true
);
else
accessandmobilitysubscriptiondata
.
setMicoAllowed
(
false
);
}
else
if
(
!
strcmp
(
"sharedAmDataIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
sharedamdataids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sharedamdataids
);
accessandmobilitysubscriptiondata
.
setSharedAmDataIds
(
sharedamdataids
);
}
else
if
(
!
strcmp
(
"odbPacketServices"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
OdbPacketServices
odbpacketservices
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
odbpacketservices
);
accessandmobilitysubscriptiondata
.
setOdbPacketServices
(
odbpacketservices
);
}
else
if
(
!
strcmp
(
"serviceGapTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setServiceGapTime
(
a
);
}
else
if
(
!
strcmp
(
"mdtUserConsent"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
MdtUserConsent
mdtuserconsent
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
mdtuserconsent
);
accessandmobilitysubscriptiondata
.
setMdtUserConsent
(
mdtuserconsent
);
}
else
if
(
!
strcmp
(
"mdtConfiguration"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
MdtConfiguration
mdtconfiguration
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
mdtconfiguration
);
accessandmobilitysubscriptiondata
.
setMdtConfiguration
(
mdtconfiguration
);
}
else
if
(
!
strcmp
(
"traceData"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
TraceData
tracedata
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
tracedata
);
accessandmobilitysubscriptiondata
.
setTraceData
(
tracedata
);
}
else
if
(
!
strcmp
(
"cagData"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
CagData
cagdata
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
cagdata
);
accessandmobilitysubscriptiondata
.
setCagData
(
cagdata
);
}
else
if
(
!
strcmp
(
"stnSr"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setStnSr
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"cMsisdn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setCMsisdn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"nbIoTUePriority"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
accessandmobilitysubscriptiondata
.
setNbIoTUePriority
(
a
);
}
else
if
(
!
strcmp
(
"nssaiInclusionAllowed"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setNssaiInclusionAllowed
(
true
);
else
accessandmobilitysubscriptiondata
.
setNssaiInclusionAllowed
(
false
);
}
else
if
(
!
strcmp
(
"rgWirelineCharacteristics"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
accessandmobilitysubscriptiondata
.
setRgWirelineCharacteristics
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"ecRestrictionDataWb"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
EcRestrictionDataWb
ecrestrictiondatawb
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
ecrestrictiondatawb
);
accessandmobilitysubscriptiondata
.
setEcRestrictionDataWb
(
ecrestrictiondatawb
);
}
else
if
(
!
strcmp
(
"ecRestrictionDataNb"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setEcRestrictionDataNb
(
true
);
else
accessandmobilitysubscriptiondata
.
setEcRestrictionDataNb
(
false
);
}
else
if
(
!
strcmp
(
"expectedUeBehaviourList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ExpectedUeBehaviourData
expecteduebehaviourlist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
expecteduebehaviourlist
);
accessandmobilitysubscriptiondata
.
setExpectedUeBehaviourList
(
expecteduebehaviourlist
);
}
else
if
(
!
strcmp
(
"primaryRatRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
RatType
>
primaryratrestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
primaryratrestrictions
);
accessandmobilitysubscriptiondata
.
setPrimaryRatRestrictions
(
primaryratrestrictions
);
}
else
if
(
!
strcmp
(
"secondaryRatRestrictions"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
RatType
>
secondaryratrestrictions
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
secondaryratrestrictions
);
accessandmobilitysubscriptiondata
.
setSecondaryRatRestrictions
(
secondaryratrestrictions
);
}
else
if
(
!
strcmp
(
"edrxParametersList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
EdrxParameters
>
edrxparameterslist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
edrxparameterslist
);
accessandmobilitysubscriptiondata
.
setEdrxParametersList
(
edrxparameterslist
);
}
else
if
(
!
strcmp
(
"ptwParametersList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
PtwParameters
>
ptwparameterslist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
ptwparameterslist
);
accessandmobilitysubscriptiondata
.
setPtwParametersList
(
ptwparameterslist
);
}
else
if
(
!
strcmp
(
"iabOperationAllowed"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
accessandmobilitysubscriptiondata
.
setIabOperationAllowed
(
true
);
else
accessandmobilitysubscriptiondata
.
setIabOperationAllowed
(
false
);
}
else
if
(
!
strcmp
(
"wirelineForbiddenAreas"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
WirelineArea
>
wirelineforbiddenareas
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
wirelineforbiddenareas
);
accessandmobilitysubscriptiondata
.
setWirelineForbiddenAreas
(
wirelineforbiddenareas
);
}
else
if
(
!
strcmp
(
"wirelineServiceAreaRestriction"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
WirelineServiceAreaRestriction
wirelineservicearearestriction
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
wirelineservicearearestriction
);
accessandmobilitysubscriptiondata
.
setWirelineServiceAreaRestriction
(
wirelineservicearearestriction
);
}
}
to_json
(
j
,
accessandmobilitysubscriptiondata
);
// response.send(Pistache::Http::Code::Ok, j.dump());
// TODO:
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"AccessAndMobilitySubscriptionData GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"AccessAndMobilitySubscriptionData no data!"
);
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_amf_3gpp_access_registration_document_create_amf_context
(
const
std
::
string
&
ue_id
,
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_AMF3GPPAccessRegistration
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
ue_id
+
"'"
;
std
::
string
query
;
nlohmann
::
json
j
;
if
(
mysql_real_query
(
&
mysql
,
select_AMF3GPPAccessRegistration
.
c_str
(),
(
unsigned
long
)
select_AMF3GPPAccessRegistration
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_AMF3GPPAccessRegistration
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_AMF3GPPAccessRegistration
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
query
=
"update Amf3GppAccessRegistration set amfInstanceId='"
+
amf3GppAccessRegistration
.
getAmfInstanceId
()
+
"'"
+
(
amf3GppAccessRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
amf3GppAccessRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
purgeFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isPurgeFlag
()
?
",purgeFlag=1"
:
",purgeFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
peiIsSet
()
?
",pei='"
+
amf3GppAccessRegistration
.
getPei
()
+
"'"
:
""
)
+
",deregCallbackUri='"
+
amf3GppAccessRegistration
.
getDeregCallbackUri
()
+
"'"
+
(
amf3GppAccessRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
amf3GppAccessRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
initialRegistrationIndIsSet
()
?
(
amf3GppAccessRegistration
.
isInitialRegistrationInd
()
?
",initialRegistrationInd=1"
:
",initialRegistrationInd=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
drFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isDrFlag
()
?
",drFlag=1"
:
",drFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
urrpIndicatorIsSet
()
?
(
amf3GppAccessRegistration
.
isUrrpIndicator
()
?
",urrpIndicator=1"
:
",urrpIndicator=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
amfEeSubscriptionIdIsSet
()
?
",amfEeSubscriptionId='"
+
amf3GppAccessRegistration
.
getAmfEeSubscriptionId
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
ueSrvccCapabilityIsSet
()
?
(
amf3GppAccessRegistration
.
isUeSrvccCapability
()
?
",ueSrvccCapability=1"
:
",ueSrvccCapability=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
amf3GppAccessRegistration
.
getRegistrationTime
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
noEeSubscriptionIndIsSet
()
?
(
amf3GppAccessRegistration
.
isNoEeSubscriptionInd
()
?
",noEeSubscriptionInd=1"
:
",noEeSubscriptionInd=0"
)
:
""
);
if
(
amf3GppAccessRegistration
.
imsVoPsIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getImsVoPs
());
query
+=
",imsVoPs='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNameDeregIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNameDereg
());
query
+=
",amfServiceNameDereg='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNamePcscfRestIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNamePcscfRest
());
query
+=
",amfServiceNamePcscfRest='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
backupAmfInfoIsSet
())
{
nlohmann
::
json
tmp
;
j
.
clear
();
std
::
vector
<
BackupAmfInfo
>
backupamfinfo
=
amf3GppAccessRegistration
.
getBackupAmfInfo
();
for
(
int
i
=
0
;
i
<
backupamfinfo
.
size
();
i
++
)
{
to_json
(
tmp
,
backupamfinfo
[
i
]);
j
+=
tmp
;
}
query
+=
",backupAmfInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
epsInterworkingInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getEpsInterworkingInfo
());
query
+=
",epsInterworkingInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
vgmlcAddressIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getVgmlcAddress
());
query
+=
",vgmlcAddress='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
amf3GppAccessRegistration
.
getGuami
());
query
+=
",guami='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
amf3GppAccessRegistration
.
getRatType
());
query
+=
",ratType='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ue_id
+
"'"
;
}
else
{
query
=
"insert into Amf3GppAccessRegistration set ueid='"
+
ue_id
+
"'"
+
",amfInstanceId='"
+
amf3GppAccessRegistration
.
getAmfInstanceId
()
+
"'"
+
(
amf3GppAccessRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
amf3GppAccessRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
purgeFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isPurgeFlag
()
?
",purgeFlag=1"
:
",purgeFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
peiIsSet
()
?
",pei='"
+
amf3GppAccessRegistration
.
getPei
()
+
"'"
:
""
)
+
",deregCallbackUri='"
+
amf3GppAccessRegistration
.
getDeregCallbackUri
()
+
"'"
+
(
amf3GppAccessRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
amf3GppAccessRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
initialRegistrationIndIsSet
()
?
(
amf3GppAccessRegistration
.
isInitialRegistrationInd
()
?
",initialRegistrationInd=1"
:
",initialRegistrationInd=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
drFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isDrFlag
()
?
",drFlag=1"
:
",drFlag=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
urrpIndicatorIsSet
()
?
(
amf3GppAccessRegistration
.
isUrrpIndicator
()
?
",urrpIndicator=1"
:
",urrpIndicator=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
amfEeSubscriptionIdIsSet
()
?
",amfEeSubscriptionId='"
+
amf3GppAccessRegistration
.
getAmfEeSubscriptionId
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
ueSrvccCapabilityIsSet
()
?
(
amf3GppAccessRegistration
.
isUeSrvccCapability
()
?
",ueSrvccCapability=1"
:
",ueSrvccCapability=0"
)
:
""
)
+
(
amf3GppAccessRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
amf3GppAccessRegistration
.
getRegistrationTime
()
+
"'"
:
""
)
+
(
amf3GppAccessRegistration
.
noEeSubscriptionIndIsSet
()
?
(
amf3GppAccessRegistration
.
isNoEeSubscriptionInd
()
?
",noEeSubscriptionInd=1"
:
",noEeSubscriptionInd=0"
)
:
""
);
if
(
amf3GppAccessRegistration
.
imsVoPsIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getImsVoPs
());
query
+=
",imsVoPs='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNameDeregIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNameDereg
());
query
+=
",amfServiceNameDereg='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
amfServiceNamePcscfRestIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getAmfServiceNamePcscfRest
());
query
+=
",amfServiceNamePcscfRest='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
backupAmfInfoIsSet
())
{
nlohmann
::
json
tmp
;
j
.
clear
();
std
::
vector
<
BackupAmfInfo
>
backupamfinfo
=
amf3GppAccessRegistration
.
getBackupAmfInfo
();
for
(
int
i
=
0
;
i
<
backupamfinfo
.
size
();
i
++
)
{
to_json
(
tmp
,
backupamfinfo
[
i
]);
j
+=
tmp
;
}
query
+=
",backupAmfInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
epsInterworkingInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getEpsInterworkingInfo
());
query
+=
",epsInterworkingInfo='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
vgmlcAddressIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getVgmlcAddress
());
query
+=
",vgmlcAddress='"
+
j
.
dump
()
+
"'"
;
}
if
(
amf3GppAccessRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
amf3GppAccessRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
amf3GppAccessRegistration
.
getGuami
());
query
+=
",guami='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
amf3GppAccessRegistration
.
getRatType
());
query
+=
",ratType='"
+
j
.
dump
()
+
"'"
;
}
mysql_free_result
(
res
);
// std::cout << query << std::endl;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
to_json
(
j
,
amf3GppAccessRegistration
);
// response.send(Pistache::Http::Code::Created, j.dump());
// TODO:
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Created
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"Amf3GppAccessRegistration PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_amf_3gpp_access_registration_document_query_amf_context
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
Amf3GppAccessRegistration
amf3gppaccessregistration
;
const
std
::
string
query
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"amfInstanceId"
,
field
->
name
))
{
amf3gppaccessregistration
.
setAmfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"purgeFlag"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setPurgeFlag
(
true
);
else
amf3gppaccessregistration
.
setPurgeFlag
(
false
);
}
else
if
(
!
strcmp
(
"pei"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setPei
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"imsVoPs"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ImsVoPs
imsvops
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
imsvops
);
amf3gppaccessregistration
.
setImsVoPs
(
imsvops
);
}
else
if
(
!
strcmp
(
"deregCallbackUri"
,
field
->
name
))
{
amf3gppaccessregistration
.
setDeregCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceNameDereg"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicenamedereg
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicenamedereg
);
amf3gppaccessregistration
.
setAmfServiceNameDereg
(
amfservicenamedereg
);
}
else
if
(
!
strcmp
(
"pcscfRestorationCallbackUri"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setPcscfRestorationCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceNamePcscfRest"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicenamepcscfrest
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicenamepcscfrest
);
amf3gppaccessregistration
.
setAmfServiceNamePcscfRest
(
amfservicenamepcscfrest
);
}
else
if
(
!
strcmp
(
"initialRegistrationInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setInitialRegistrationInd
(
true
);
else
amf3gppaccessregistration
.
setInitialRegistrationInd
(
false
);
}
else
if
(
!
strcmp
(
"guami"
,
field
->
name
))
{
Guami
guami
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
guami
);
amf3gppaccessregistration
.
setGuami
(
guami
);
}
else
if
(
!
strcmp
(
"backupAmfInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
BackupAmfInfo
>
backupamfinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
backupamfinfo
);
amf3gppaccessregistration
.
setBackupAmfInfo
(
backupamfinfo
);
}
else
if
(
!
strcmp
(
"drFlag"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setDrFlag
(
true
);
else
amf3gppaccessregistration
.
setDrFlag
(
false
);
}
else
if
(
!
strcmp
(
"ratType"
,
field
->
name
))
{
RatType
rattype
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
rattype
);
amf3gppaccessregistration
.
setRatType
(
rattype
);
}
else
if
(
!
strcmp
(
"urrpIndicator"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setUrrpIndicator
(
true
);
else
amf3gppaccessregistration
.
setUrrpIndicator
(
false
);
}
else
if
(
!
strcmp
(
"amfEeSubscriptionId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setAmfEeSubscriptionId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"epsInterworkingInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
EpsInterworkingInfo
epsinterworkinginfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
epsinterworkinginfo
);
amf3gppaccessregistration
.
setEpsInterworkingInfo
(
epsinterworkinginfo
);
}
else
if
(
!
strcmp
(
"ueSrvccCapability"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setUeSrvccCapability
(
true
);
else
amf3gppaccessregistration
.
setUeSrvccCapability
(
false
);
}
else
if
(
!
strcmp
(
"registrationTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
amf3gppaccessregistration
.
setRegistrationTime
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"vgmlcAddress"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
VgmlcAddress
vgmlcaddress
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
vgmlcaddress
);
amf3gppaccessregistration
.
setVgmlcAddress
(
vgmlcaddress
);
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
amf3gppaccessregistration
.
setContextInfo
(
contextinfo
);
}
else
if
(
!
strcmp
(
"noEeSubscriptionInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
amf3gppaccessregistration
.
setNoEeSubscriptionInd
(
true
);
else
amf3gppaccessregistration
.
setNoEeSubscriptionInd
(
false
);
}
}
to_json
(
j
,
amf3gppaccessregistration
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"Amf3GppAccessRegistration GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"Amf3GppAccessRegistration no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_create_authentication_status
(
const
std
::
string
&
ue_id
,
const
AuthEvent
&
authEvent
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
// response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_AuthenticationStatus
=
"select * from AuthenticationStatus WHERE ueid='"
+
ue_id
+
"'"
;
std
::
string
query
;
nlohmann
::
json
j
;
if
(
mysql_real_query
(
&
mysql
,
select_AuthenticationStatus
.
c_str
(),
(
unsigned
long
)
select_AuthenticationStatus
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_AuthenticationStatus
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_AuthenticationStatus
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
query
=
"update AuthenticationStatus set nfInstanceId='"
+
authEvent
.
getNfInstanceId
()
+
"'"
+
",success="
+
(
authEvent
.
isSuccess
()
?
"1"
:
"0"
)
+
",timeStamp='"
+
authEvent
.
getTimeStamp
()
+
"'"
+
",authType='"
+
authEvent
.
getAuthType
()
+
"'"
+
",servingNetworkName='"
+
authEvent
.
getServingNetworkName
()
+
"'"
+
(
authEvent
.
authRemovalIndIsSet
()
?
(
authEvent
.
isAuthRemovalInd
()
?
",authRemovalInd=1"
:
",authRemovalInd=0"
)
:
""
);
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
query
+=
" where ueid='"
+
ue_id
+
"'"
;
}
else
{
query
=
"insert into AuthenticationStatus set ueid='"
+
ue_id
+
"'"
+
",nfInstanceId='"
+
authEvent
.
getNfInstanceId
()
+
"'"
+
",success="
+
(
authEvent
.
isSuccess
()
?
"1"
:
"0"
)
+
",timeStamp='"
+
authEvent
.
getTimeStamp
()
+
"'"
+
",authType='"
+
authEvent
.
getAuthType
()
+
"'"
+
",servingNetworkName='"
+
authEvent
.
getServingNetworkName
()
+
"'"
+
(
authEvent
.
authRemovalIndIsSet
()
?
(
authEvent
.
isAuthRemovalInd
()
?
",authRemovalInd=1"
:
",authRemovalInd=0"
)
:
""
);
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
}
mysql_free_result
(
res
);
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql create failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data
=
{};
code
=
Pistache
::
Http
::
Code
::
No_Content
;
to_json
(
j
,
authEvent
);
Logger
::
udr_server
().
debug
(
"AuthenticationStatus PUT - json:
\n\"
%s
\"
"
,
j
.
dump
().
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_delete_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
const
std
::
string
query
=
"DELETE from AuthenticationStatus WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data
=
{};
code
=
Pistache
::
Http
::
Code
::
No_Content
;
Logger
::
udr_server
().
debug
(
"AuthenticationStatus DELETE - successful"
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
AuthEvent
authenticationstatus
;
const
std
::
string
query
=
"select * from AuthenticationStatus WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!"
);
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"nfInstanceId"
,
field
->
name
))
{
authenticationstatus
.
setNfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"success"
,
field
->
name
))
{
if
(
strcmp
(
row
[
i
],
"0"
))
authenticationstatus
.
setSuccess
(
true
);
else
authenticationstatus
.
setSuccess
(
false
);
}
else
if
(
!
strcmp
(
"timeStamp"
,
field
->
name
))
{
authenticationstatus
.
setTimeStamp
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"authType"
,
field
->
name
))
{
// AuthType authtype;
// nlohmann::json::parse(row[i]).get_to(authtype);
authenticationstatus
.
setAuthType
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"servingNetworkName"
,
field
->
name
))
{
authenticationstatus
.
setServingNetworkName
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"authRemovalInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
authenticationstatus
.
setAuthRemovalInd
(
true
);
else
authenticationstatus
.
setAuthRemovalInd
(
false
);
}
}
to_json
(
j
,
authenticationstatus
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
Logger
::
udr_server
().
debug
(
"AuthenticationStatus GET - json:
\n\"
%s
\"
"
,
j
.
dump
().
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"AuthenticationStatus no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_modify_authentication_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_Authenticationsubscription
=
"select * from AuthenticationSubscription WHERE ueid='"
+
ue_id
+
"'"
;
std
::
string
query
;
nlohmann
::
json
j
,
tmp_j
;
for
(
int
i
=
0
;
i
<
patchItem
.
size
();
i
++
)
{
if
((
!
strcmp
(
patchItem
[
i
].
getOp
().
c_str
(),
PATCH_OPERATION_REPLACE
))
&&
patchItem
[
i
].
valueIsSet
())
{
patchItem
[
i
].
getValue
();
SequenceNumber
sequencenumber
;
nlohmann
::
json
::
parse
(
patchItem
[
i
].
getValue
().
c_str
())
.
get_to
(
sequencenumber
);
if
(
mysql_real_query
(
&
mysql
,
select_Authenticationsubscription
.
c_str
(),
(
unsigned
long
)
select_Authenticationsubscription
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_Authenticationsubscription
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_Authenticationsubscription
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
nlohmann
::
json
sequencenumber_j
;
query
=
"update AuthenticationSubscription set sequenceNumber='"
;
to_json
(
sequencenumber_j
,
sequencenumber
);
query
+=
sequencenumber_j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ue_id
+
"'"
;
}
else
{
Logger
::
udr_server
().
error
(
"AuthenticationSubscription no data!SQL(%s)"
,
select_Authenticationsubscription
.
c_str
());
}
mysql_free_result
(
res
);
// Logger::udr_server().debug("modify content:
// %s",query.c_str());
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"update mysql failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
}
to_json
(
tmp_j
,
patchItem
[
i
]);
j
+=
tmp_j
;
}
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"AuthenticationSubscription PATCH - json:
\n\"
%s
\"
"
,
out
.
c_str
());
response_data
=
{};
code
=
Pistache
::
Http
::
Code
::
No_Content
;
// response.send(Pistache::Http::Code::No_Content, "");
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_read_authentication_subscription
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
AuthenticationSubscription
authenticationsubscription
;
const
std
::
string
query
=
"select * from AuthenticationSubscription WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"authenticationMethod"
,
field
->
name
))
{
// AuthMethod authenticationmethod;
// nlohmann::json::parse(row[i]).get_to(authenticationmethod);
authenticationsubscription
.
setAuthenticationMethod
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"encPermanentKey"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setEncPermanentKey
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"protectionParameterId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setProtectionParameterId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"sequenceNumber"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SequenceNumber
sequencenumber
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sequencenumber
);
authenticationsubscription
.
setSequenceNumber
(
sequencenumber
);
}
else
if
(
!
strcmp
(
"authenticationManagementField"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setAuthenticationManagementField
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"algorithmId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setAlgorithmId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"encOpcKey"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setEncOpcKey
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"encTopcKey"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setEncTopcKey
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"vectorGenerationInHss"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
cout
<<
row
[
i
]
<<
std
::
endl
;
if
(
strcmp
(
row
[
i
],
"0"
))
authenticationsubscription
.
setVectorGenerationInHss
(
true
);
else
authenticationsubscription
.
setVectorGenerationInHss
(
false
);
}
else
if
(
!
strcmp
(
"n5gcAuthMethod"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// AuthMethod n5gcauthmethod;
// nlohmann::json::parse(row[i]).get_to(n5gcauthmethod);
authenticationsubscription
.
setN5gcAuthMethod
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"rgAuthenticationInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
cout
<<
row
[
i
]
<<
std
::
endl
;
if
(
strcmp
(
row
[
i
],
"0"
))
authenticationsubscription
.
setRgAuthenticationInd
(
true
);
else
authenticationsubscription
.
setRgAuthenticationInd
(
false
);
}
else
if
(
!
strcmp
(
"supi"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
authenticationsubscription
.
setSupi
(
row
[
i
]);
}
}
to_json
(
j
,
authenticationsubscription
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"AuthenticationSubscription GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"AuthenticationSubscription no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
SdmSubscription
SdmSubscriptions
;
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ue_id
+
"' AND subsId="
+
subs_id
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"nfInstanceId"
,
field
->
name
))
{
SdmSubscriptions
.
setNfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"implicitUnsubscribe"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
SdmSubscriptions
.
setImplicitUnsubscribe
(
true
);
else
SdmSubscriptions
.
setImplicitUnsubscribe
(
false
);
}
else
if
(
!
strcmp
(
"expires"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setExpires
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"callbackReference"
,
field
->
name
))
{
SdmSubscriptions
.
setCallbackReference
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceName"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicename
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicename
);
SdmSubscriptions
.
setAmfServiceName
(
amfservicename
);
}
else
if
(
!
strcmp
(
"monitoredResourceUris"
,
field
->
name
))
{
std
::
vector
<
std
::
string
>
monitoredresourceuris
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
monitoredresourceuris
);
SdmSubscriptions
.
setMonitoredResourceUris
(
monitoredresourceuris
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
SdmSubscriptions
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setDnn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"subscriptionId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setSubscriptionId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"plmnId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
SdmSubscriptions
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"immediateReport"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
SdmSubscriptions
.
setImmediateReport
(
true
);
else
SdmSubscriptions
.
setImmediateReport
(
false
);
}
else
if
(
!
strcmp
(
"report"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SubscriptionDataSets
report
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
report
);
SdmSubscriptions
.
setReport
(
report
);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
SdmSubscriptions
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
SdmSubscriptions
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
j
,
SdmSubscriptions
);
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
// response.send(Pistache::Http::Code::Ok, j.dump());
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SdmSubscription GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"SdmSubscription no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_remove_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
nlohmann
::
json
j
;
ProblemDetails
problemdetails
;
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ue_id
+
"' AND subsId="
+
subs_id
;
const
std
::
string
query
=
"DELETE from SdmSubscriptions WHERE ueid='"
+
ue_id
+
"' AND subsId="
+
subs_id
;
if
(
mysql_real_query
(
&
mysql
,
select_query
.
c_str
(),
(
unsigned
long
)
select_query
.
size
()))
{
problemdetails
.
setCause
(
"USER_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Not_Found
;
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
problemdetails
.
setCause
(
"USER_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Not_Found
;
return
;
}
if
(
!
mysql_num_rows
(
res
))
{
problemdetails
.
setCause
(
"DATA_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Not_Found
;
return
;
}
mysql_free_result
(
res
);
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
problemdetails
.
setCause
(
"USER_NOT_FOUND"
);
to_json
(
j
,
problemdetails
);
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Not_Found
;
return
;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data
=
{};
code
=
Pistache
::
Http
::
Code
::
No_Content
;
Logger
::
udr_server
().
debug
(
"SdmSubscription DELETE - successful"
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ue_id
+
"' AND subsId="
+
subs_id
;
std
::
string
query
;
nlohmann
::
json
j
;
ProblemDetails
problemdetails
;
if
(
mysql_real_query
(
&
mysql
,
select_query
.
c_str
(),
(
unsigned
long
)
select_query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
nlohmann
::
json
MonitoredResourceUris_json
(
sdmSubscription
.
getMonitoredResourceUris
());
query
=
"update SdmSubscriptions set nfInstanceId='"
+
sdmSubscription
.
getNfInstanceId
()
+
"'"
+
(
sdmSubscription
.
implicitUnsubscribeIsSet
()
?
(
sdmSubscription
.
isImplicitUnsubscribe
()
?
",implicitUnsubscribe=1"
:
",implicitUnsubscribe=0"
)
:
""
)
+
(
sdmSubscription
.
expiresIsSet
()
?
",expires='"
+
sdmSubscription
.
getExpires
()
+
"'"
:
""
)
+
",callbackReference='"
+
sdmSubscription
.
getCallbackReference
()
+
"'"
+
(
sdmSubscription
.
dnnIsSet
()
?
",dnn='"
+
sdmSubscription
.
getDnn
()
+
"'"
:
""
)
+
(
sdmSubscription
.
subscriptionIdIsSet
()
?
",subscriptionId='"
+
sdmSubscription
.
getSubscriptionId
()
+
"'"
:
""
)
+
(
sdmSubscription
.
immediateReportIsSet
()
?
(
sdmSubscription
.
isImmediateReport
()
?
",immediateReport=1"
:
",immediateReport=0"
)
:
""
)
+
(
sdmSubscription
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
sdmSubscription
.
getSupportedFeatures
()
+
"'"
:
""
);
if
(
sdmSubscription
.
amfServiceNameIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getAmfServiceName
());
query
+=
",amfServiceName='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
singleNssaiIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
plmnIdIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
reportIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getReport
());
query
+=
",report='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
contextInfoIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
query
+=
",monitoredResourceUris='"
+
MonitoredResourceUris_json
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ue_id
+
"' AND subsId="
+
subs_id
;
}
else
{
to_json
(
j
,
problemdetails
);
// response.send(Pistache::Http::Code::Not_Found, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Not_Found
;
mysql_free_result
(
res
);
return
;
}
mysql_free_result
(
res
);
// std::cout << query << std::endl;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data
=
{};
code
=
Pistache
::
Http
::
Code
::
No_Content
;
to_json
(
j
,
sdmSubscription
);
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SdmSubscription PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_create_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
nlohmann
::
json
j
;
int32_t
subs_id
=
0
;
int32_t
count
=
0
;
std
::
string
query
=
"SELECT subsId from SdmSubscriptions WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
while
(
row
=
mysql_fetch_row
(
res
))
{
count
++
;
if
(
strcmp
(
row
[
0
],
std
::
to_string
(
count
).
c_str
()))
{
subs_id
=
count
;
break
;
}
}
mysql_free_result
(
res
);
//****** add query *******
query
=
"insert into SdmSubscriptions set ueid='"
+
ue_id
+
"'"
+
",nfInstanceId='"
+
sdmSubscription
.
getNfInstanceId
()
+
"'"
+
(
sdmSubscription
.
implicitUnsubscribeIsSet
()
?
(
sdmSubscription
.
isImplicitUnsubscribe
()
?
",implicitUnsubscribe=1"
:
",implicitUnsubscribe=0"
)
:
""
)
+
(
sdmSubscription
.
expiresIsSet
()
?
",expires='"
+
sdmSubscription
.
getExpires
()
+
"'"
:
""
)
+
",callbackReference='"
+
sdmSubscription
.
getCallbackReference
()
+
"'"
+
(
sdmSubscription
.
dnnIsSet
()
?
",dnn='"
+
sdmSubscription
.
getDnn
()
+
"'"
:
""
)
+
(
sdmSubscription
.
subscriptionIdIsSet
()
?
",subscriptionId='"
+
sdmSubscription
.
getSubscriptionId
()
+
"'"
:
""
)
+
(
sdmSubscription
.
immediateReportIsSet
()
?
(
sdmSubscription
.
isImmediateReport
()
?
",immediateReport=1"
:
",immediateReport=0"
)
:
""
)
+
(
sdmSubscription
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
sdmSubscription
.
getSupportedFeatures
()
+
"'"
:
""
);
if
(
sdmSubscription
.
amfServiceNameIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getAmfServiceName
());
query
+=
",amfServiceName='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
singleNssaiIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
plmnIdIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
reportIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getReport
());
query
+=
",report='"
+
j
.
dump
()
+
"'"
;
}
if
(
sdmSubscription
.
contextInfoIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
nlohmann
::
json
MonitoredResourceUris_json
(
sdmSubscription
.
getMonitoredResourceUris
());
query
+=
",monitoredResourceUris='"
+
MonitoredResourceUris_json
.
dump
()
+
"'"
;
if
(
subs_id
&&
(
subs_id
==
count
))
{
query
+=
",subsId="
+
std
::
to_string
(
subs_id
);
}
//************************
// std::cout << query << std::endl;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
to_json
(
j
,
sdmSubscription
);
// response.send(Pistache::Http::Code::Created, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Created
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SdmSubscriptions POST - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
std
::
vector
<
std
::
string
>
fields
;
nlohmann
::
json
j
,
tmp
;
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
while
(
field
=
mysql_fetch_field
(
res
))
{
fields
.
push_back
(
field
->
name
);
}
j
.
clear
();
while
(
row
=
mysql_fetch_row
(
res
))
{
SdmSubscription
sdmsubscriptions
;
tmp
.
clear
();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++
)
{
if
(
!
strcmp
(
"nfInstanceId"
,
fields
[
i
].
c_str
()))
{
sdmsubscriptions
.
setNfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"implicitUnsubscribe"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
sdmsubscriptions
.
setImplicitUnsubscribe
(
true
);
else
sdmsubscriptions
.
setImplicitUnsubscribe
(
false
);
}
else
if
(
!
strcmp
(
"expires"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
sdmsubscriptions
.
setExpires
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"callbackReference"
,
fields
[
i
].
c_str
()))
{
sdmsubscriptions
.
setCallbackReference
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"amfServiceName"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
ServiceName
amfservicename
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicename
);
sdmsubscriptions
.
setAmfServiceName
(
amfservicename
);
}
else
if
(
!
strcmp
(
"monitoredResourceUris"
,
fields
[
i
].
c_str
()))
{
std
::
vector
<
std
::
string
>
monitoredresourceuris
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
monitoredresourceuris
);
sdmsubscriptions
.
setMonitoredResourceUris
(
monitoredresourceuris
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
sdmsubscriptions
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
sdmsubscriptions
.
setDnn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"subscriptionId"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
sdmsubscriptions
.
setSubscriptionId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"plmnId"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
sdmsubscriptions
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"immediateReport"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
sdmsubscriptions
.
setImmediateReport
(
true
);
else
sdmsubscriptions
.
setImmediateReport
(
false
);
}
else
if
(
!
strcmp
(
"report"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
SubscriptionDataSets
report
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
report
);
sdmsubscriptions
.
setReport
(
report
);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
sdmsubscriptions
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"contextInfo"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
sdmsubscriptions
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
tmp
,
sdmsubscriptions
);
j
+=
tmp
;
}
mysql_free_result
(
res
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SdmSubscriptions GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
SessionManagementSubscriptionData
sessionmanagementsubscriptiondata
;
const
std
::
string
query
=
"select * from SessionManagementSubscriptionData WHERE ueid='"
+
ue_id
+
"' and servingPlmnid='"
+
serving_plmn_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
))
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
sessionmanagementsubscriptiondata
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnnConfigurations"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
DnnConfiguration
>
dnnconfigurations
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
dnnconfigurations
);
sessionmanagementsubscriptiondata
.
setDnnConfigurations
(
dnnconfigurations
);
}
else
if
(
!
strcmp
(
"internalGroupIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
vector
<
std
::
string
>
internalgroupIds
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
internalgroupIds
);
sessionmanagementsubscriptiondata
.
setInternalGroupIds
(
internalgroupIds
);
}
else
if
(
!
strcmp
(
"sharedVnGroupDataIds"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
std
::
string
>
sharedvngroupdataids
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
sharedvngroupdataids
);
sessionmanagementsubscriptiondata
.
setSharedVnGroupDataIds
(
sharedvngroupdataids
);
}
else
if
(
!
strcmp
(
"sharedDnnConfigurationsId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
sessionmanagementsubscriptiondata
.
setSharedDnnConfigurationsId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"odbPacketServices"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
OdbPacketServices
odbpacketservices
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
odbpacketservices
);
sessionmanagementsubscriptiondata
.
setOdbPacketServices
(
odbpacketservices
);
}
else
if
(
!
strcmp
(
"traceData"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
TraceData
tracedata
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
tracedata
);
sessionmanagementsubscriptiondata
.
setTraceData
(
tracedata
);
}
else
if
(
!
strcmp
(
"sharedTraceDataId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
sessionmanagementsubscriptiondata
.
setSharedTraceDataId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"expectedUeBehavioursList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
ExpectedUeBehaviourData
>
expecteduebehaviourslist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
expecteduebehaviourslist
);
sessionmanagementsubscriptiondata
.
setExpectedUeBehavioursList
(
expecteduebehaviourslist
);
}
else
if
(
!
strcmp
(
"suggestedPacketNumDlList"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
SuggestedPacketNumDl
>
suggestedpacketnumdllist
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
suggestedpacketnumdllist
);
sessionmanagementsubscriptiondata
.
setSuggestedPacketNumDlList
(
suggestedpacketnumdllist
);
}
else
if
(
!
strcmp
(
"3gppChargingCharacteristics"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
sessionmanagementsubscriptiondata
.
setR3gppChargingCharacteristics
(
row
[
i
]);
}
}
to_json
(
j
,
sessionmanagementsubscriptiondata
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SessionManagementSubscriptionData GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"SessionManagementSubscriptionData no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_create_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
const
std
::
string
select_SmfRegistration
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ue_id
+
"' AND subpduSessionId="
+
std
::
to_string
(
pdu_session_id
);
std
::
string
query
;
nlohmann
::
json
j
;
if
(
mysql_real_query
(
&
mysql
,
select_SmfRegistration
.
c_str
(),
(
unsigned
long
)
select_SmfRegistration
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_SmfRegistration
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_SmfRegistration
.
c_str
());
return
;
}
if
(
mysql_num_rows
(
res
))
{
query
=
"update SmfRegistrations set smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"'"
+
",pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
(
smfRegistration
.
smfSetIdIsSet
()
?
",smfSetId='"
+
smfRegistration
.
getSmfSetId
()
+
"'"
:
""
)
+
(
smfRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
smfRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
smfRegistration
.
dnnIsSet
()
?
",dnn='"
+
smfRegistration
.
getDnn
()
+
"'"
:
""
)
+
(
smfRegistration
.
emergencyServicesIsSet
()
?
(
smfRegistration
.
isEmergencyServices
()
?
",emergencyServices=1"
:
",emergencyServices=0"
)
:
""
)
+
(
smfRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
smfRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
pgwFqdnIsSet
()
?
",pgwFqdn='"
+
smfRegistration
.
getPgwFqdn
()
+
"'"
:
""
)
+
(
smfRegistration
.
epdgIndIsSet
()
?
(
smfRegistration
.
isEpdgInd
()
?
",epdgInd=1"
:
",epdgInd=0"
)
:
""
)
+
(
smfRegistration
.
deregCallbackUriIsSet
()
?
",deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
smfRegistration
.
getRegistrationTime
()
+
"'"
:
""
);
if
(
smfRegistration
.
registrationReasonIsSet
())
{
to_json
(
j
,
smfRegistration
.
getRegistrationReason
());
query
+=
",registrationReason='"
+
j
.
dump
()
+
"'"
;
}
if
(
smfRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
smfRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
smfRegistration
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ue_id
+
"' AND subpduSessionId="
+
std
::
to_string
(
pdu_session_id
);
}
else
{
query
=
"insert into SmfRegistrations set ueid='"
+
ue_id
+
"'"
+
",subpduSessionId="
+
std
::
to_string
(
pdu_session_id
)
+
",pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
",smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"'"
+
(
smfRegistration
.
smfSetIdIsSet
()
?
",smfSetId='"
+
smfRegistration
.
getSmfSetId
()
+
"'"
:
""
)
+
(
smfRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
smfRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
(
smfRegistration
.
dnnIsSet
()
?
",dnn='"
+
smfRegistration
.
getDnn
()
+
"'"
:
""
)
+
(
smfRegistration
.
emergencyServicesIsSet
()
?
(
smfRegistration
.
isEmergencyServices
()
?
",emergencyServices=1"
:
",emergencyServices=0"
)
:
""
)
+
(
smfRegistration
.
pcscfRestorationCallbackUriIsSet
()
?
",pcscfRestorationCallbackUri='"
+
smfRegistration
.
getPcscfRestorationCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
pgwFqdnIsSet
()
?
",pgwFqdn='"
+
smfRegistration
.
getPgwFqdn
()
+
"'"
:
""
)
+
(
smfRegistration
.
epdgIndIsSet
()
?
(
smfRegistration
.
isEpdgInd
()
?
",epdgInd=1"
:
",epdgInd=0"
)
:
""
)
+
(
smfRegistration
.
deregCallbackUriIsSet
()
?
",deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"'"
:
""
)
+
(
smfRegistration
.
registrationTimeIsSet
()
?
",registrationTime='"
+
smfRegistration
.
getRegistrationTime
()
+
"'"
:
""
);
if
(
smfRegistration
.
registrationReasonIsSet
())
{
to_json
(
j
,
smfRegistration
.
getRegistrationReason
());
query
+=
",registrationReason='"
+
j
.
dump
()
+
"'"
;
}
if
(
smfRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
smfRegistration
.
getContextInfo
());
query
+=
",contextInfo='"
+
j
.
dump
()
+
"'"
;
}
to_json
(
j
,
smfRegistration
.
getSingleNssai
());
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
}
mysql_free_result
(
res
);
// std::cout << query << std::endl;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
to_json
(
j
,
smfRegistration
);
// response.send(Pistache::Http::Code::Created, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Created
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SmfRegistration PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
const
std
::
string
query
=
"DELETE from SmfRegistrations WHERE ueid='"
+
ue_id
+
"' AND subpduSessionId="
+
std
::
to_string
(
pdu_session_id
);
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
// response.send(Pistache::Http::Code::No_Content, "");
response_data
=
{};
code
=
Pistache
::
Http
::
Code
::
No_Content
;
Logger
::
udr_server
().
debug
(
"SmfRegistration DELETE - successful"
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
SmfRegistration
smfregistration
;
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ue_id
+
"' AND subpduSessionId="
+
std
::
to_string
(
pdu_session_id
);
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"smfInstanceId"
,
field
->
name
))
{
smfregistration
.
setSmfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"smfSetId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setSmfSetId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"pduSessionId"
,
field
->
name
))
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
smfregistration
.
setPduSessionId
(
a
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
))
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
smfregistration
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setDnn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"emergencyServices"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
smfregistration
.
setEmergencyServices
(
true
);
else
smfregistration
.
setEmergencyServices
(
false
);
}
else
if
(
!
strcmp
(
"pcscfRestorationCallbackUri"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setPcscfRestorationCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"plmnId"
,
field
->
name
))
{
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
smfregistration
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"pgwFqdn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setPgwFqdn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"epdgInd"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
smfregistration
.
setEpdgInd
(
true
);
else
smfregistration
.
setEpdgInd
(
false
);
}
else
if
(
!
strcmp
(
"deregCallbackUri"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setDeregCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"registrationReason"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
RegistrationReason
registrationreason
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
registrationreason
);
smfregistration
.
setRegistrationReason
(
registrationreason
);
}
else
if
(
!
strcmp
(
"registrationTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setRegistrationTime
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
smfregistration
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
j
,
smfregistration
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SmfRegistration GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"SmfRegistration no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
std
::
vector
<
std
::
string
>
fields
;
nlohmann
::
json
j
,
tmp
;
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ue_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
while
(
field
=
mysql_fetch_field
(
res
))
{
fields
.
push_back
(
field
->
name
);
}
j
.
clear
();
while
(
row
=
mysql_fetch_row
(
res
))
{
SmfRegistration
smfregistration
;
tmp
.
clear
();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++
)
{
if
(
!
strcmp
(
"smfInstanceId"
,
fields
[
i
].
c_str
()))
{
smfregistration
.
setSmfInstanceId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"smfSetId"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setSmfSetId
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"pduSessionId"
,
fields
[
i
].
c_str
()))
{
std
::
string
s
=
row
[
i
];
std
::
stringstream
ss
;
int32_t
a
;
ss
<<
s
;
ss
>>
a
;
smfregistration
.
setPduSessionId
(
a
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
fields
[
i
].
c_str
()))
{
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
smfregistration
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setDnn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"emergencyServices"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
smfregistration
.
setEmergencyServices
(
true
);
else
smfregistration
.
setEmergencyServices
(
false
);
}
else
if
(
!
strcmp
(
"pcscfRestorationCallbackUri"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setPcscfRestorationCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"plmnId"
,
fields
[
i
].
c_str
()))
{
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
smfregistration
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"pgwFqdn"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setPgwFqdn
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"epdgInd"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
if
(
strcmp
(
row
[
i
],
"0"
))
smfregistration
.
setEpdgInd
(
true
);
else
smfregistration
.
setEpdgInd
(
false
);
}
else
if
(
!
strcmp
(
"deregCallbackUri"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setDeregCallbackUri
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"registrationReason"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
RegistrationReason
registrationreason
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
registrationreason
);
smfregistration
.
setRegistrationReason
(
registrationreason
);
}
else
if
(
!
strcmp
(
"registrationTime"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
smfregistration
.
setRegistrationTime
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"contextInfo"
,
fields
[
i
].
c_str
())
&&
row
[
i
]
!=
NULL
)
{
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
smfregistration
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
tmp
,
smfregistration
);
j
+=
tmp
;
}
mysql_free_result
(
res
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SmfRegistrations GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
Pistache
::
Http
::
Code
&
code
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
SmfSelectionSubscriptionData
smfselectionsubscriptiondata
;
const
std
::
string
query
=
"select * from SmfSelectionSubscriptionData WHERE ueid='"
+
ue_id
+
"' and servingPlmnid='"
+
serving_plmn_id
+
"'"
;
if
(
mysql_real_query
(
&
mysql
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
res
=
mysql_store_result
(
&
mysql
);
if
(
res
==
NULL
)
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
query
.
c_str
());
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfselectionsubscriptiondata
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"subscribedSnssaiInfos"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
std
::
map
<
std
::
string
,
SnssaiInfo
>
subscribedsnssaiinfos
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
subscribedsnssaiinfos
);
smfselectionsubscriptiondata
.
setSubscribedSnssaiInfos
(
subscribedsnssaiinfos
);
}
else
if
(
!
strcmp
(
"sharedSnssaiInfosId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfselectionsubscriptiondata
.
setSharedSnssaiInfosId
(
row
[
i
]);
}
}
to_json
(
j
,
smfselectionsubscriptiondata
);
// response.send(Pistache::Http::Code::Ok, j.dump());
response_data
=
j
;
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
out
=
j
.
dump
();
Logger
::
udr_server
().
debug
(
"SmfSelectionSubscriptionData GET - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
else
{
Logger
::
udr_server
().
error
(
"SmfSelectionSubscriptionData no data!SQL(%s)"
,
query
.
c_str
());
}
mysql_free_result
(
res
);
}
src/udr_app/udr_app.hpp
View file @
789c6c85
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment