Commit a1b1240a authored by yangjian's avatar yangjian

Update AuthenticationSubscription: add fields(authenticationMethod/sequenceNumber/n5gcAuthMethod)

parent 11d0ae93
/** /**
* Nudr_DataRepository API OpenAPI file * Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 2.1.2 * The version of the OpenAPI document: 2.1.2
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech * https://openapi-generator.tech
...@@ -27,128 +27,133 @@ using namespace org::openapitools::server::model; ...@@ -27,128 +27,133 @@ using namespace org::openapitools::server::model;
AuthenticationSubscriptionDocumentApiImpl::AuthenticationSubscriptionDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr,MYSQL *mysql) AuthenticationSubscriptionDocumentApiImpl::AuthenticationSubscriptionDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr,MYSQL *mysql)
: AuthenticationSubscriptionDocumentApi(rtr) : AuthenticationSubscriptionDocumentApi(rtr)
{ {
mysql_WitcommUDRDB = mysql; mysql_WitcommUDRDB = mysql;
} }
void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscription(const std::string &ueId, const std::vector<PatchItem> &patchItem, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) { void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscription(const std::string &ueId, const std::vector<PatchItem> &patchItem, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) {
/************************ test ************************/ /************************ test ************************/
nlohmann::json j,j1; nlohmann::json j,j1;
for(int i=0;i<patchItem.size();i++) for(int i=0;i<patchItem.size();i++)
{ {
to_json(j1,patchItem[i]); to_json(j1,patchItem[i]);
j+=j1; j+=j1;
} }
response.send(Pistache::Http::Code::Ok, j.dump()); response.send(Pistache::Http::Code::Ok, j.dump());
//response.send(Pistache::Http::Code::Ok, "Do some magic hello\n"); //response.send(Pistache::Http::Code::Ok, "Do some magic hello\n");
/******************************************************/ /******************************************************/
//1.modify handler //1.modify handler
//2.modify success //2.modify success
//3.send PatchResult //3.send PatchResult
//response.send(Pistache::Http::Code::Ok, j.dump()); //response.send(Pistache::Http::Code::Ok, j.dump());
} }
void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription(const std::string &ueId, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription(const std::string &ueId, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response)
{ {
MYSQL_RES *res = NULL; MYSQL_RES *res = NULL;
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_FIELD* field = nullptr; MYSQL_FIELD* field = nullptr;
nlohmann::json j; nlohmann::json j;
AuthenticationSubscription authenticationsubscription; AuthenticationSubscription authenticationsubscription;
const std::string query = "select * from AuthenticationSubscription WHERE ueid="+ueId; const std::string query = "select * from AuthenticationSubscription WHERE ueid="+ueId;
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size())) if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{ {
std::cout << "mysql_real_query failure!" << std::endl; std::cout << "mysql_real_query failure!" << std::endl;
return; return;
} }
std::cout << "mysql_real_query successful!" << std::endl;
res = mysql_store_result(mysql_WitcommUDRDB);
res = mysql_store_result(mysql_WitcommUDRDB); if(res == NULL)
if(res == NULL) {
{ std::cout << "mysql_store_result failure!" << std::endl;
std::cout << "mysql_store_result failure!" << std::endl; return;
return; }
}
row = mysql_fetch_row(res);
row = mysql_fetch_row(res);
if(row != NULL)
if(row != NULL) {
{ for (int i = 0; field = mysql_fetch_field(res); i++)
for (int i = 0; field = mysql_fetch_field(res); i++) {
{ if(!strcmp("authenticationMethod", field->name))
if(!strcmp("authenticationMethod", field->name)) {
{ AuthMethod authenticationmethod;
//authenticationsubscription.setAuthenticationMethod((AuthMethod) row[i]); nlohmann::json::parse(row[i]).get_to(authenticationmethod);
} authenticationsubscription.setAuthenticationMethod(authenticationmethod);
else if(!strcmp("encPermanentKey", field->name)) }
{ else if(!strcmp("encPermanentKey", field->name) && row[i] != NULL)
authenticationsubscription.setEncPermanentKey(row[i]); {
} authenticationsubscription.setEncPermanentKey(row[i]);
else if(!strcmp("protectionParameterId", field->name)) }
{ else if(!strcmp("protectionParameterId", field->name) && row[i] != NULL)
authenticationsubscription.setProtectionParameterId(row[i]); {
} authenticationsubscription.setProtectionParameterId(row[i]);
else if(!strcmp("sequenceNumber", field->name)) }
{ else if(!strcmp("sequenceNumber", field->name) && row[i] != NULL)
//authenticationsubscription.setSequenceNumber((SequenceNumber) row[i]); {
} SequenceNumber sequencenumber;
else if(!strcmp("authenticationManagementField", field->name)) nlohmann::json::parse(row[i]).get_to(sequencenumber);
{ authenticationsubscription.setSequenceNumber(sequencenumber);
authenticationsubscription.setAuthenticationManagementField(row[i]); }
} else if(!strcmp("authenticationManagementField", field->name) && row[i] != NULL)
else if(!strcmp("algorithmId", field->name)) {
{ authenticationsubscription.setAuthenticationManagementField(row[i]);
authenticationsubscription.setAlgorithmId(row[i]); }
} else if(!strcmp("algorithmId", field->name) && row[i] != NULL)
else if(!strcmp("encOpcKey", field->name)) {
{ authenticationsubscription.setAlgorithmId(row[i]);
authenticationsubscription.setEncOpcKey(row[i]); }
} else if(!strcmp("encOpcKey", field->name) && row[i] != NULL)
else if(!strcmp("encTopcKey", field->name)) {
{ authenticationsubscription.setEncOpcKey(row[i]);
authenticationsubscription.setEncTopcKey(row[i]); }
} else if(!strcmp("encTopcKey", field->name) && row[i] != NULL)
else if(!strcmp("vectorGenerationInHss", field->name)) {
{ authenticationsubscription.setEncTopcKey(row[i]);
std::cout<<row[i]<<std::endl; }
if(strcmp(row[i], "0")) else if(!strcmp("vectorGenerationInHss", field->name) && row[i] != NULL)
authenticationsubscription.setVectorGenerationInHss(true); {
else std::cout<<row[i]<<std::endl;
authenticationsubscription.setVectorGenerationInHss(false); if(strcmp(row[i], "0"))
} authenticationsubscription.setVectorGenerationInHss(true);
else if(!strcmp("n5gcAuthMethod", field->name)) else
{ authenticationsubscription.setVectorGenerationInHss(false);
//authenticationsubscription.setN5gcAuthMethod(AuthMethod const & value); }
} else if(!strcmp("n5gcAuthMethod", field->name) && row[i] != NULL)
else if(!strcmp("rgAuthenticationInd", field->name)) {
{ AuthMethod n5gcauthmethod;
std::cout<<row[i]<<std::endl; nlohmann::json::parse(row[i]).get_to(n5gcauthmethod);
if(strcmp(row[i], "0")) authenticationsubscription.setN5gcAuthMethod(n5gcauthmethod);
authenticationsubscription.setRgAuthenticationInd(true); }
else else if(!strcmp("rgAuthenticationInd", field->name) && row[i] != NULL)
authenticationsubscription.setRgAuthenticationInd(false); {
} std::cout<<row[i]<<std::endl;
else if(!strcmp("supi", field->name)) if(strcmp(row[i], "0"))
{ authenticationsubscription.setRgAuthenticationInd(true);
authenticationsubscription.setSupi(row[i]); else
} authenticationsubscription.setRgAuthenticationInd(false);
} }
else if(!strcmp("supi", field->name) && row[i] != NULL)
to_json(j,authenticationsubscription); {
response.send(Pistache::Http::Code::Ok, j.dump()); authenticationsubscription.setSupi(row[i]);
} }
else }
{
std::cout << "AuthenticationSubscription no data!" << std::endl; to_json(j,authenticationsubscription);
} response.send(Pistache::Http::Code::Ok, j.dump());
}
mysql_free_result(res); else
{
std::cout << "AuthenticationSubscription no data!" << std::endl;
}
mysql_free_result(res);
} }
......
/** /**
* Nudr_DataRepository API OpenAPI file * Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 2.1.2 * The version of the OpenAPI document: 2.1.2
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech * https://openapi-generator.tech
...@@ -26,7 +26,7 @@ PatchItem::PatchItem() ...@@ -26,7 +26,7 @@ PatchItem::PatchItem()
m_From = ""; m_From = "";
m_FromIsSet = false; m_FromIsSet = false;
m_ValueIsSet = false; m_ValueIsSet = false;
} }
PatchItem::~PatchItem() PatchItem::~PatchItem()
...@@ -51,19 +51,19 @@ void to_json(nlohmann::json& j, const PatchItem& o) ...@@ -51,19 +51,19 @@ void to_json(nlohmann::json& j, const PatchItem& o)
void from_json(const nlohmann::json& j, PatchItem& o) void from_json(const nlohmann::json& j, PatchItem& o)
{ {
cout<<"patchitem from_json "<<endl; // cout<<"patchitem from_json "<<endl;
j.at("op").get_to(o.m_Op); j.at("op").get_to(o.m_Op);
j.at("path").get_to(o.m_Path); j.at("path").get_to(o.m_Path);
if(j.find("from") != j.end()) if(j.find("from") != j.end())
{ {
j.at("from").get_to(o.m_From); j.at("from").get_to(o.m_From);
o.m_FromIsSet = true; o.m_FromIsSet = true;
} }
if(j.find("value") != j.end()) if(j.find("value") != j.end())
{ {
// j.at("value").get_to(o.m_Value); // j.at("value").get_to(o.m_Value);
// o.m_ValueIsSet = true; // o.m_ValueIsSet = true;
} }
} }
PatchOperation PatchItem::getOp() const PatchOperation PatchItem::getOp() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment