Commit 008d8bb5 authored by Fang-WANG's avatar Fang-WANG

plmnid process is ok

parent 9477c7e6
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "AccessAndMobilitySubscriptionDataRetrievalApi.h" #include "AccessAndMobilitySubscriptionDataRetrievalApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "conversions.hpp"
namespace oai { namespace oai {
namespace udm { namespace udm {
...@@ -62,14 +63,16 @@ void AccessAndMobilitySubscriptionDataRetrievalApi::get_am_data_handler( ...@@ -62,14 +63,16 @@ void AccessAndMobilitySubscriptionDataRetrievalApi::get_am_data_handler(
} }
auto plmnIdQuery = request.query().get("plmn-id"); auto plmnIdQuery = request.query().get("plmn-id");
Pistache::Optional<PlmnId> plmnId; Pistache::Optional<PlmnId> plmnId;
/* if(!plmnIdQuery.isEmpty()){ if(!plmnIdQuery.isEmpty()){
PlmnId value; PlmnId value;
if(fromStringValue(plmnIdQuery.get(), value)){ std::string valueplmnIdQuery= plmnIdQuery.get();
std::string valuechange = conv::UrlDecode(valueplmnIdQuery);
nlohmann::json::parse(valuechange).get_to(value);
plmnId = Pistache::Some(value); plmnId = Pistache::Some(value);
}
} }
*/ // Getting the header params // Getting the header params
auto ifNoneMatch = request.headers().tryGetRaw("If-None-Match"); auto ifNoneMatch = request.headers().tryGetRaw("If-None-Match");
auto ifModifiedSince = request.headers().tryGetRaw("If-Modified-Since"); auto ifModifiedSince = request.headers().tryGetRaw("If-Modified-Since");
......
...@@ -208,3 +208,21 @@ void conv::hex_str_to_uint8(const char *string, uint8_t *des) { ...@@ -208,3 +208,21 @@ void conv::hex_str_to_uint8(const char *string, uint8_t *des) {
index++; index++;
} }
} }
std::string conv::UrlDecode(std::string &SRC)
{
std::string ret;
char ch;
int ii;
for (size_t i=0; i<SRC.length(); i++) {
if (int(SRC[i])==37) {
sscanf(SRC.substr(i+1,2).c_str(), "%x", &ii);
ch=static_cast<char>(ii);
ret+=ch;
i=i+2;
} else {
ret+=SRC[i];
}
}
return (ret);
}
\ No newline at end of file
...@@ -58,5 +58,7 @@ public: ...@@ -58,5 +58,7 @@ public:
const uint8_t digit3); const uint8_t digit3);
static std::string uint8_to_hex_string(const uint8_t *v, const size_t s); static std::string uint8_to_hex_string(const uint8_t *v, const size_t s);
static void hex_str_to_uint8(const char *string, uint8_t *des); static void hex_str_to_uint8(const char *string, uint8_t *des);
static std::string UrlDecode(std::string &SRC);
}; };
#endif /* FILE_CONVERSIONS_HPP_SEEN */ #endif /* FILE_CONVERSIONS_HPP_SEEN */
...@@ -43,7 +43,7 @@ void AccessAndMobilitySubscriptionDataRetrievalApiImpl::get_am_data( ...@@ -43,7 +43,7 @@ void AccessAndMobilitySubscriptionDataRetrievalApiImpl::get_am_data(
std::string udr_ip = std::string(inet_ntoa(*((struct in_addr *)&udm_cfg.nudr.addr4))); std::string udr_ip = std::string(inet_ntoa(*((struct in_addr *)&udm_cfg.nudr.addr4)));
std::string udr_port = std::to_string(udm_cfg.nudr.port); std::string udr_port = std::to_string(udm_cfg.nudr.port);
//std::string remote_uri = udr_ip + ":" + udr_port + "/nudr-dr/v2/subscription-data/"+supi+plmnId+"/provisioned-data/am-data"; //std::string remote_uri = udr_ip + ":" + udr_port + "/nudr-dr/v2/subscription-data/"+supi+plmnId+"/provisioned-data/am-data";
std::string remote_uri = udr_ip + ":" + udr_port + "/nudr-dr/v2/subscription-data/"+supi+"/456789/provisioned-data/am-data"; std::string remote_uri = udr_ip + ":" + udr_port + "/nudr-dr/v2/subscription-data/"+supi+"/"+plmnId.get().getMcc() +plmnId.get().getMnc()+"/provisioned-data/am-data";
std::string method("GET"); std::string method("GET");
std::string body(""); std::string body("");
......
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