Commit 4a80bc71 authored by Mosaical's avatar Mosaical

20210319

parent 1a0c03fc
...@@ -29,6 +29,9 @@ include_directories(impl) ...@@ -29,6 +29,9 @@ include_directories(impl)
include_directories(zkH) include_directories(zkH)
include_directories(json) include_directories(json)
include_directories(nlohmann) include_directories(nlohmann)
include_directories(/usr/local/include/librdkafka)
#include_directories(json-include/json) #include_directories(json-include/json)
#link_libraries(/home/root/nrf2/lib/lib_json.lib) #link_libraries(/home/root/nrf2/lib/lib_json.lib)
add_subdirectory(json-include) add_subdirectory(json-include)
...@@ -42,4 +45,4 @@ file(GLOB SRCS ...@@ -42,4 +45,4 @@ file(GLOB SRCS
add_executable(${PROJECT_NAME} ${SRCS} ) add_executable(${PROJECT_NAME} ${SRCS} )
#add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN) #add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN)
target_link_libraries(${PROJECT_NAME} pistache pthread zookeeper_mt jsoncpp) target_link_libraries(${PROJECT_NAME} pistache pthread zookeeper_mt jsoncpp rdkafka)
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <vector>
namespace org { namespace org {
namespace openapitools { namespace openapitools {
namespace server { namespace server {
...@@ -230,6 +231,32 @@ this->get_nf_instance(nfInstanceID, response); ...@@ -230,6 +231,32 @@ this->get_nf_instance(nfInstanceID, response);
void NFInstanceIDDocumentApi::register_nf_instance_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { void NFInstanceIDDocumentApi::register_nf_instance_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params // Getting the path params
auto nfInstanceID = request.param(":nfInstanceID").as<std::string>(); auto nfInstanceID = request.param(":nfInstanceID").as<std::string>();
//auto version = request.version();
//auto method = request.method();
auto resource = request.resource();
std::cout << " reqResource is : " << resource << std::endl;
//下面生成注册的URI
std::string resourceString = resource;
int resourceFlag = 0;
int theThirdFlag = 0;
for(;;){
if(resource[resourceFlag]=='/') theThirdFlag++;
if (theThirdFlag == 3) break;
resourceFlag++;
};
std::cout << "resourceFlag is : " << resourceFlag << std::endl;
std::string uriRight(resourceString, resourceFlag);
std::cout << "uriRight is : " << uriRight << std::endl;
//auto path1 = request.path();
//auto reqUri1 = request.cookies();
//std::cout << " reqUri1 is : " << reqUri1 << std::endl;
//auto reqResource = request.resource().c_str();
//std::cout << " reqResource is : " << reqUri << std::endl;
printf("request body : %s\n",request.body().c_str()); printf("request body : %s\n",request.body().c_str());
printf("================================================="); printf("=================================================");
std::cout << "nfInstanceID::" << nfInstanceID << std::endl; std::cout << "nfInstanceID::" << nfInstanceID << std::endl;
...@@ -255,7 +282,26 @@ void NFInstanceIDDocumentApi::register_nf_instance_handler(const Pistache::Rest: ...@@ -255,7 +282,26 @@ void NFInstanceIDDocumentApi::register_nf_instance_handler(const Pistache::Rest:
//测试结束 //测试结束
nlohmann::json j0; nlohmann::json j0;
j0 = nlohmann::json::parse(requestBodyString); j0 = nlohmann::json::parse(requestBodyString);
this->register_nf_instance(nfInstanceID, nFProfile, contentEncoding, acceptEncoding, response, j0); std::string ipv4AddressString = j0.at("ipv4Addresses").dump();
std::string ipv4AddressString2(ipv4AddressString,2);
if(j0.contains("ipv4Addresses")){
std::vector<std::string> ipv4AddressV;
int ipv4Flag = ipv4AddressV.size();
//std::cout << "ipv4AddressesString is : " << ipv4AddressString;
//假设只给了一个ip
//std::string ipv4AddressString2(ipv4AddressString,2);
std::string::iterator it;
for(it = ipv4AddressString2.begin(); it !=ipv4AddressString2.end(); it++){
if(*it == '"'){
ipv4AddressString2.erase(it);
}
}
ipv4AddressString2 = ipv4AddressString2.substr(0, ipv4AddressString2.length()-1);
}
std::string URI = ipv4AddressString2 + uriRight;
std::cout << "URI is : " << URI << std::endl;
this->register_nf_instance(nfInstanceID, nFProfile, contentEncoding, acceptEncoding, response, j0, URI);
} catch (nlohmann::detail::exception &e) { } catch (nlohmann::detail::exception &e) {
//send a 400 error //send a 400 error
printf("400未解析到信息!\n"); printf("400未解析到信息!\n");
......
...@@ -85,7 +85,7 @@ private: ...@@ -85,7 +85,7 @@ private:
/// <param name="nFProfile"></param> /// <param name="nFProfile"></param>
/// <param name="contentEncoding">Content-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param> /// <param name="contentEncoding">Content-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param>
/// <param name="acceptEncoding">Accept-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param> /// <param name="acceptEncoding">Accept-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param>
virtual void register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &j0) = 0; virtual void register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &j0, std::string URI) = 0;
/// <summary> /// <summary>
/// Update NF Instance profile /// Update NF Instance profile
......
...@@ -43,6 +43,14 @@ void SubscriptionsCollectionApi::create_subscription_handler(const Pistache::Res ...@@ -43,6 +43,14 @@ void SubscriptionsCollectionApi::create_subscription_handler(const Pistache::Res
// Getting the body param // Getting the body param
SubscriptionData subscriptionData; SubscriptionData subscriptionData;
std::cout << "SubscriptionsCollectionApi::create_subscription_handler已启动!" << std::endl;
//nlohmann::json::parse(request.body()).get_to(subscriptionData);
std::string requestBodyString = request.body().c_str();
nlohmann::json::parse(requestBodyString).get_to(subscriptionData);//无用行
nlohmann::json jSubscriptionData;
jSubscriptionData = nlohmann::json::parse(requestBodyString);
std::cout << "jSubscriptionData is : " << jSubscriptionData << std::endl;
// Getting the header params // Getting the header params
auto contentEncoding = request.headers().tryGetRaw("Content-Encoding"); auto contentEncoding = request.headers().tryGetRaw("Content-Encoding");
...@@ -50,7 +58,7 @@ void SubscriptionsCollectionApi::create_subscription_handler(const Pistache::Res ...@@ -50,7 +58,7 @@ void SubscriptionsCollectionApi::create_subscription_handler(const Pistache::Res
try { try {
nlohmann::json::parse(request.body()).get_to(subscriptionData); nlohmann::json::parse(request.body()).get_to(subscriptionData);
this->create_subscription(subscriptionData, contentEncoding, acceptEncoding, response); this->create_subscription(subscriptionData, contentEncoding, acceptEncoding, response, jSubscriptionData/*额外加入一个*/);
} catch (nlohmann::detail::exception &e) { } catch (nlohmann::detail::exception &e) {
//send a 400 error //send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what()); response.send(Pistache::Http::Code::Bad_Request, e.what());
......
...@@ -61,7 +61,7 @@ private: ...@@ -61,7 +61,7 @@ private:
/// <param name="subscriptionData"></param> /// <param name="subscriptionData"></param>
/// <param name="contentEncoding">Content-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param> /// <param name="contentEncoding">Content-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param>
/// <param name="acceptEncoding">Accept-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param> /// <param name="acceptEncoding">Accept-Encoding, described in IETF RFC 7231 (optional, default to &quot;&quot;)</param>
virtual void create_subscription(const SubscriptionData &subscriptionData, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response) = 0; virtual void create_subscription(const SubscriptionData &subscriptionData, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &jSubscriptionData) = 0;
}; };
......
...@@ -103,6 +103,8 @@ vector ...@@ -103,6 +103,8 @@ vector
- -
discoverInformation.h discoverInformation.h
../impl/discoverInformation.h ../impl/discoverInformation.h
myNotify.h
../impl/myNotify.h
../impl/NFInstancesStoreApiImpl.h ../impl/NFInstancesStoreApiImpl.h
pistache/endpoint.h pistache/endpoint.h
...@@ -167,6 +169,8 @@ SubscriptionData.h ...@@ -167,6 +169,8 @@ SubscriptionData.h
../impl/SubscriptionData.h ../impl/SubscriptionData.h
string string
- -
subscribeNode.h
../impl/subscribeNode.h
../model/AccessType.h ../model/AccessType.h
nlohmann/json.hpp nlohmann/json.hpp
...@@ -1018,6 +1022,26 @@ zookeeperClient.h ...@@ -1018,6 +1022,26 @@ zookeeperClient.h
regex regex
- -
../zkH/myNotify.h
string
-
stdbool.h
-
iostream
-
string
-
cstdlib
-
../zkH/subscribeNode.h
string
-
stdbool.h
-
zookeeperClient.h
../zkH/zookeeperClient.h
../zkH/zk_cpp.h ../zkH/zk_cpp.h
stdint.h stdint.h
- -
...@@ -1117,6 +1141,8 @@ iostream ...@@ -1117,6 +1141,8 @@ iostream
- -
nlohmann/json.hpp nlohmann/json.hpp
- -
vector
-
/home/root/nrf2/api/NFInstanceIDDocumentApi.h /home/root/nrf2/api/NFInstanceIDDocumentApi.h
pistache/http.h pistache/http.h
...@@ -1253,6 +1279,8 @@ vector ...@@ -1253,6 +1279,8 @@ vector
- -
discoverInformation.h discoverInformation.h
/home/root/nrf2/impl/discoverInformation.h /home/root/nrf2/impl/discoverInformation.h
myNotify.h
/home/root/nrf2/impl/myNotify.h
/home/root/nrf2/impl/NFInstancesStoreApiImpl.cpp /home/root/nrf2/impl/NFInstancesStoreApiImpl.cpp
NFInstancesStoreApiImpl.h NFInstancesStoreApiImpl.h
...@@ -1329,6 +1357,8 @@ SubscriptionData.h ...@@ -1329,6 +1357,8 @@ SubscriptionData.h
/home/root/nrf2/impl/SubscriptionData.h /home/root/nrf2/impl/SubscriptionData.h
string string
- -
subscribeNode.h
/home/root/nrf2/impl/subscribeNode.h
/home/root/nrf2/json-include/json/allocator.h /home/root/nrf2/json-include/json/allocator.h
cstring cstring
...@@ -2728,6 +2758,38 @@ vector ...@@ -2728,6 +2758,38 @@ vector
nlohmann/json.hpp nlohmann/json.hpp
- -
/home/root/nrf2/zkH/HttpRequest.cpp
HttpRequest.h
/home/root/nrf2/zkH/HttpRequest.h
/home/root/nrf2/zkH/HttpRequest.h
string.h
-
stdlib.h
-
stdio.h
-
unistd.h
-
fcntl.h
-
errno.h
-
netdb.h
-
stdarg.h
-
sys/socket.h
-
netinet/in.h
-
arpa/inet.h
-
sys/types.h
-
sys/socket.h
-
/home/root/nrf2/zkH/Register.cpp /home/root/nrf2/zkH/Register.cpp
Register.h Register.h
/home/root/nrf2/zkH/Register.h /home/root/nrf2/zkH/Register.h
...@@ -2824,6 +2886,66 @@ zookeeperClient.h ...@@ -2824,6 +2886,66 @@ zookeeperClient.h
regex regex
- -
/home/root/nrf2/zkH/myNotify.cpp
myNotify.h
/home/root/nrf2/zkH/myNotify.h
stdio.h
-
iostream
-
zookeeperClient.h
/home/root/nrf2/zkH/zookeeperClient.h
get2rdNodeMessage.h
/home/root/nrf2/zkH/get2rdNodeMessage.h
HttpRequest.h
/home/root/nrf2/zkH/HttpRequest.h
nlohmann/json.hpp
-
pthread.h
-
/home/root/nrf2/zkH/myNotify.h
string
-
stdbool.h
-
iostream
-
string
-
cstdlib
-
/home/root/nrf2/zkH/myProducer.cpp
myProducer.h
/home/root/nrf2/zkH/myProducer.h
/home/root/nrf2/zkH/myProducer.h
stdio.h
-
signal.h
-
string
-
cstring
-
iostream
-
/usr/local/include/librdkafka/rdkafka.h
-
/home/root/nrf2/zkH/subscribeNode.cpp
subscribeNode.h
/home/root/nrf2/zkH/subscribeNode.h
/home/root/nrf2/zkH/subscribeNode.h
string
-
stdbool.h
-
zookeeperClient.h
/home/root/nrf2/zkH/zookeeperClient.h
/home/root/nrf2/zkH/zk_cpp.cpp /home/root/nrf2/zkH/zk_cpp.cpp
zk_cpp.h zk_cpp.h
/home/root/nrf2/zkH/zk_cpp.h /home/root/nrf2/zkH/zk_cpp.h
...@@ -2888,3 +3010,17 @@ sstream ...@@ -2888,3 +3010,17 @@ sstream
stdbool.h stdbool.h
- -
/usr/local/include/librdkafka/rdkafka.h
stdio.h
-
inttypes.h
-
sys/types.h
-
basetsd.h
-
winsock2.h
-
sys/socket.h
-
...@@ -110,10 +110,14 @@ set(CMAKE_DEPENDS_CHECK_CXX ...@@ -110,10 +110,14 @@ set(CMAKE_DEPENDS_CHECK_CXX
"/home/root/nrf2/model/UriScheme.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/model/UriScheme.cpp.o" "/home/root/nrf2/model/UriScheme.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/model/UriScheme.cpp.o"
"/home/root/nrf2/model/VendorSpecificFeature.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/model/VendorSpecificFeature.cpp.o" "/home/root/nrf2/model/VendorSpecificFeature.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/model/VendorSpecificFeature.cpp.o"
"/home/root/nrf2/model/WAgfInfo.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o" "/home/root/nrf2/model/WAgfInfo.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o"
"/home/root/nrf2/zkH/HttpRequest.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.o"
"/home/root/nrf2/zkH/Register.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/Register.cpp.o" "/home/root/nrf2/zkH/Register.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/Register.cpp.o"
"/home/root/nrf2/zkH/discoverInformation.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/discoverInformation.cpp.o" "/home/root/nrf2/zkH/discoverInformation.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/discoverInformation.cpp.o"
"/home/root/nrf2/zkH/get2rdNodeMessage.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/get2rdNodeMessage.cpp.o" "/home/root/nrf2/zkH/get2rdNodeMessage.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/get2rdNodeMessage.cpp.o"
"/home/root/nrf2/zkH/inforMatch.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o" "/home/root/nrf2/zkH/inforMatch.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o"
"/home/root/nrf2/zkH/myNotify.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/myNotify.cpp.o"
"/home/root/nrf2/zkH/myProducer.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/myProducer.cpp.o"
"/home/root/nrf2/zkH/subscribeNode.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o"
"/home/root/nrf2/zkH/zk_cpp.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o" "/home/root/nrf2/zkH/zk_cpp.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o"
"/home/root/nrf2/zkH/zookeeperClient.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/zookeeperClient.cpp.o" "/home/root/nrf2/zkH/zookeeperClient.cpp" "/home/root/nrf2/build/CMakeFiles/api-server.dir/zkH/zookeeperClient.cpp.o"
) )
...@@ -128,6 +132,7 @@ set(CMAKE_CXX_TARGET_INCLUDE_PATH ...@@ -128,6 +132,7 @@ set(CMAKE_CXX_TARGET_INCLUDE_PATH
"../zkH" "../zkH"
"../json" "../json"
"../nlohmann" "../nlohmann"
"/usr/local/include/librdkafka"
) )
# Targets to which this target links. # Targets to which this target links.
......
This diff is collapsed.
...@@ -104,10 +104,14 @@ file(REMOVE_RECURSE ...@@ -104,10 +104,14 @@ file(REMOVE_RECURSE
"CMakeFiles/api-server.dir/model/UriScheme.cpp.o" "CMakeFiles/api-server.dir/model/UriScheme.cpp.o"
"CMakeFiles/api-server.dir/model/VendorSpecificFeature.cpp.o" "CMakeFiles/api-server.dir/model/VendorSpecificFeature.cpp.o"
"CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o" "CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o"
"CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.o"
"CMakeFiles/api-server.dir/zkH/Register.cpp.o" "CMakeFiles/api-server.dir/zkH/Register.cpp.o"
"CMakeFiles/api-server.dir/zkH/discoverInformation.cpp.o" "CMakeFiles/api-server.dir/zkH/discoverInformation.cpp.o"
"CMakeFiles/api-server.dir/zkH/get2rdNodeMessage.cpp.o" "CMakeFiles/api-server.dir/zkH/get2rdNodeMessage.cpp.o"
"CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o" "CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o"
"CMakeFiles/api-server.dir/zkH/myNotify.cpp.o"
"CMakeFiles/api-server.dir/zkH/myProducer.cpp.o"
"CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o"
"CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o" "CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o"
"CMakeFiles/api-server.dir/zkH/zookeeperClient.cpp.o" "CMakeFiles/api-server.dir/zkH/zookeeperClient.cpp.o"
"CMakeFiles/api-server.dir/main-api-server.cpp.o" "CMakeFiles/api-server.dir/main-api-server.cpp.o"
......
...@@ -214,6 +214,7 @@ CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o ...@@ -214,6 +214,7 @@ CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o
../model/WAgfInfo.h ../model/WAgfInfo.h
../zkH/Register.h ../zkH/Register.h
../zkH/discoverInformation.h ../zkH/discoverInformation.h
../zkH/myNotify.h
../zkH/zk_cpp.h ../zkH/zk_cpp.h
../zkH/zookeeperClient.h ../zkH/zookeeperClient.h
/home/root/nrf2/impl/NFInstanceIDDocumentApiImpl.cpp /home/root/nrf2/impl/NFInstanceIDDocumentApiImpl.cpp
...@@ -252,6 +253,9 @@ CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o ...@@ -252,6 +253,9 @@ CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o
../model/ProblemDetails.h ../model/ProblemDetails.h
../model/Snssai.h ../model/Snssai.h
../model/SubscriptionData.h ../model/SubscriptionData.h
../zkH/subscribeNode.h
../zkH/zk_cpp.h
../zkH/zookeeperClient.h
/home/root/nrf2/impl/SubscriptionsCollectionApiImpl.cpp /home/root/nrf2/impl/SubscriptionsCollectionApiImpl.cpp
/home/root/nrf2/impl/SubscriptionsCollectionApiImpl.h /home/root/nrf2/impl/SubscriptionsCollectionApiImpl.h
CMakeFiles/api-server.dir/main-api-server.cpp.o CMakeFiles/api-server.dir/main-api-server.cpp.o
...@@ -347,6 +351,10 @@ CMakeFiles/api-server.dir/main-api-server.cpp.o ...@@ -347,6 +351,10 @@ CMakeFiles/api-server.dir/main-api-server.cpp.o
../model/VendorSpecificFeature.h ../model/VendorSpecificFeature.h
../model/WAgfInfo.h ../model/WAgfInfo.h
../zkH/discoverInformation.h ../zkH/discoverInformation.h
../zkH/myNotify.h
../zkH/subscribeNode.h
../zkH/zk_cpp.h
../zkH/zookeeperClient.h
/home/root/nrf2/main-api-server.cpp /home/root/nrf2/main-api-server.cpp
CMakeFiles/api-server.dir/model/AccessType.cpp.o CMakeFiles/api-server.dir/model/AccessType.cpp.o
/home/root/nrf2/model/AccessType.cpp /home/root/nrf2/model/AccessType.cpp
...@@ -972,6 +980,9 @@ CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o ...@@ -972,6 +980,9 @@ CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o
/home/root/nrf2/model/Ipv6Addr.h /home/root/nrf2/model/Ipv6Addr.h
/home/root/nrf2/model/WAgfInfo.cpp /home/root/nrf2/model/WAgfInfo.cpp
/home/root/nrf2/model/WAgfInfo.h /home/root/nrf2/model/WAgfInfo.h
CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.o
/home/root/nrf2/zkH/HttpRequest.cpp
/home/root/nrf2/zkH/HttpRequest.h
CMakeFiles/api-server.dir/zkH/Register.cpp.o CMakeFiles/api-server.dir/zkH/Register.cpp.o
/home/root/nrf2/zkH/Register.cpp /home/root/nrf2/zkH/Register.cpp
/home/root/nrf2/zkH/Register.h /home/root/nrf2/zkH/Register.h
...@@ -989,6 +1000,22 @@ CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o ...@@ -989,6 +1000,22 @@ CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o
/home/root/nrf2/zkH/inforMatch.h /home/root/nrf2/zkH/inforMatch.h
/home/root/nrf2/zkH/zk_cpp.h /home/root/nrf2/zkH/zk_cpp.h
/home/root/nrf2/zkH/zookeeperClient.h /home/root/nrf2/zkH/zookeeperClient.h
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o
/home/root/nrf2/zkH/HttpRequest.h
/home/root/nrf2/zkH/get2rdNodeMessage.h
/home/root/nrf2/zkH/myNotify.cpp
/home/root/nrf2/zkH/myNotify.h
/home/root/nrf2/zkH/zk_cpp.h
/home/root/nrf2/zkH/zookeeperClient.h
CMakeFiles/api-server.dir/zkH/myProducer.cpp.o
/home/root/nrf2/zkH/myProducer.cpp
/home/root/nrf2/zkH/myProducer.h
/usr/local/include/librdkafka/rdkafka.h
CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o
/home/root/nrf2/zkH/subscribeNode.cpp
/home/root/nrf2/zkH/subscribeNode.h
/home/root/nrf2/zkH/zk_cpp.h
/home/root/nrf2/zkH/zookeeperClient.h
CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o
../zookeeper-3.4.5/proto.h ../zookeeper-3.4.5/proto.h
../zookeeper-3.4.5/recordio.h ../zookeeper-3.4.5/recordio.h
......
...@@ -213,6 +213,7 @@ CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../model/Vendo ...@@ -213,6 +213,7 @@ CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../model/Vendo
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../model/WAgfInfo.h CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../model/WAgfInfo.h
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/Register.h CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/Register.h
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/discoverInformation.h CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/discoverInformation.h
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/myNotify.h
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/zk_cpp.h CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/zk_cpp.h
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/zookeeperClient.h CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../zkH/zookeeperClient.h
CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../impl/NFInstanceIDDocumentApiImpl.cpp CMakeFiles/api-server.dir/impl/NFInstanceIDDocumentApiImpl.cpp.o: ../impl/NFInstanceIDDocumentApiImpl.cpp
...@@ -251,6 +252,9 @@ CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/Pl ...@@ -251,6 +252,9 @@ CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/Pl
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/ProblemDetails.h CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/ProblemDetails.h
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/Snssai.h CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/Snssai.h
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/SubscriptionData.h CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../model/SubscriptionData.h
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../zkH/subscribeNode.h
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../zkH/zk_cpp.h
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../zkH/zookeeperClient.h
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../impl/SubscriptionsCollectionApiImpl.cpp CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../impl/SubscriptionsCollectionApiImpl.cpp
CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../impl/SubscriptionsCollectionApiImpl.h CMakeFiles/api-server.dir/impl/SubscriptionsCollectionApiImpl.cpp.o: ../impl/SubscriptionsCollectionApiImpl.h
...@@ -346,6 +350,10 @@ CMakeFiles/api-server.dir/main-api-server.cpp.o: ../model/UriScheme.h ...@@ -346,6 +350,10 @@ CMakeFiles/api-server.dir/main-api-server.cpp.o: ../model/UriScheme.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../model/VendorSpecificFeature.h CMakeFiles/api-server.dir/main-api-server.cpp.o: ../model/VendorSpecificFeature.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../model/WAgfInfo.h CMakeFiles/api-server.dir/main-api-server.cpp.o: ../model/WAgfInfo.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../zkH/discoverInformation.h CMakeFiles/api-server.dir/main-api-server.cpp.o: ../zkH/discoverInformation.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../zkH/myNotify.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../zkH/subscribeNode.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../zkH/zk_cpp.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../zkH/zookeeperClient.h
CMakeFiles/api-server.dir/main-api-server.cpp.o: ../main-api-server.cpp CMakeFiles/api-server.dir/main-api-server.cpp.o: ../main-api-server.cpp
CMakeFiles/api-server.dir/model/AccessType.cpp.o: ../model/AccessType.cpp CMakeFiles/api-server.dir/model/AccessType.cpp.o: ../model/AccessType.cpp
...@@ -972,6 +980,9 @@ CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o: ../model/Ipv6Addr.h ...@@ -972,6 +980,9 @@ CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o: ../model/Ipv6Addr.h
CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o: ../model/WAgfInfo.cpp CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o: ../model/WAgfInfo.cpp
CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o: ../model/WAgfInfo.h CMakeFiles/api-server.dir/model/WAgfInfo.cpp.o: ../model/WAgfInfo.h
CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.o: ../zkH/HttpRequest.cpp
CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.o: ../zkH/HttpRequest.h
CMakeFiles/api-server.dir/zkH/Register.cpp.o: ../zkH/Register.cpp CMakeFiles/api-server.dir/zkH/Register.cpp.o: ../zkH/Register.cpp
CMakeFiles/api-server.dir/zkH/Register.cpp.o: ../zkH/Register.h CMakeFiles/api-server.dir/zkH/Register.cpp.o: ../zkH/Register.h
CMakeFiles/api-server.dir/zkH/Register.cpp.o: ../zkH/zk_cpp.h CMakeFiles/api-server.dir/zkH/Register.cpp.o: ../zkH/zk_cpp.h
...@@ -989,6 +1000,22 @@ CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o: ../zkH/inforMatch.h ...@@ -989,6 +1000,22 @@ CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o: ../zkH/inforMatch.h
CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o: ../zkH/zk_cpp.h CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o: ../zkH/zk_cpp.h
CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o: ../zkH/zookeeperClient.h CMakeFiles/api-server.dir/zkH/inforMatch.cpp.o: ../zkH/zookeeperClient.h
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o: ../zkH/HttpRequest.h
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o: ../zkH/get2rdNodeMessage.h
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o: ../zkH/myNotify.cpp
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o: ../zkH/myNotify.h
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o: ../zkH/zk_cpp.h
CMakeFiles/api-server.dir/zkH/myNotify.cpp.o: ../zkH/zookeeperClient.h
CMakeFiles/api-server.dir/zkH/myProducer.cpp.o: ../zkH/myProducer.cpp
CMakeFiles/api-server.dir/zkH/myProducer.cpp.o: ../zkH/myProducer.h
CMakeFiles/api-server.dir/zkH/myProducer.cpp.o: /usr/local/include/librdkafka/rdkafka.h
CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o: ../zkH/subscribeNode.cpp
CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o: ../zkH/subscribeNode.h
CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o: ../zkH/zk_cpp.h
CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o: ../zkH/zookeeperClient.h
CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o: ../zookeeper-3.4.5/proto.h CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o: ../zookeeper-3.4.5/proto.h
CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o: ../zookeeper-3.4.5/recordio.h CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o: ../zookeeper-3.4.5/recordio.h
CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o: ../zookeeper-3.4.5/zookeeper.h CMakeFiles/api-server.dir/zkH/zk_cpp.cpp.o: ../zookeeper-3.4.5/zookeeper.h
......
...@@ -6,5 +6,5 @@ CXX_FLAGS = -std=c++14 -pg -g3 ...@@ -6,5 +6,5 @@ CXX_FLAGS = -std=c++14 -pg -g3
CXX_DEFINES = CXX_DEFINES =
CXX_INCLUDES = -I/home/root/nrf2/zookeeper-3.4.5 -I/home/root/nrf2/model -I/home/root/nrf2/api -I/home/root/nrf2/impl -I/home/root/nrf2/zkH -I/home/root/nrf2/json -I/home/root/nrf2/nlohmann CXX_INCLUDES = -I/home/root/nrf2/zookeeper-3.4.5 -I/home/root/nrf2/model -I/home/root/nrf2/api -I/home/root/nrf2/impl -I/home/root/nrf2/zkH -I/home/root/nrf2/json -I/home/root/nrf2/nlohmann -I/usr/local/include/librdkafka
This diff is collapsed.
...@@ -4,111 +4,115 @@ CMAKE_PROGRESS_3 = 2 ...@@ -4,111 +4,115 @@ CMAKE_PROGRESS_3 = 2
CMAKE_PROGRESS_4 = 3 CMAKE_PROGRESS_4 = 3
CMAKE_PROGRESS_5 = 4 CMAKE_PROGRESS_5 = 4
CMAKE_PROGRESS_6 = 5 CMAKE_PROGRESS_6 = 5
CMAKE_PROGRESS_7 = 6 CMAKE_PROGRESS_7 =
CMAKE_PROGRESS_8 = 7 CMAKE_PROGRESS_8 = 6
CMAKE_PROGRESS_9 = CMAKE_PROGRESS_9 = 7
CMAKE_PROGRESS_10 = 8 CMAKE_PROGRESS_10 = 8
CMAKE_PROGRESS_11 = 9 CMAKE_PROGRESS_11 = 9
CMAKE_PROGRESS_12 = 10 CMAKE_PROGRESS_12 = 10
CMAKE_PROGRESS_13 = 11 CMAKE_PROGRESS_13 = 11
CMAKE_PROGRESS_14 = 12 CMAKE_PROGRESS_14 =
CMAKE_PROGRESS_15 = 13 CMAKE_PROGRESS_15 = 12
CMAKE_PROGRESS_16 = 14 CMAKE_PROGRESS_16 = 13
CMAKE_PROGRESS_17 = 15 CMAKE_PROGRESS_17 = 14
CMAKE_PROGRESS_18 = CMAKE_PROGRESS_18 = 15
CMAKE_PROGRESS_19 = 16 CMAKE_PROGRESS_19 = 16
CMAKE_PROGRESS_20 = 17 CMAKE_PROGRESS_20 = 17
CMAKE_PROGRESS_21 = 18 CMAKE_PROGRESS_21 =
CMAKE_PROGRESS_22 = 19 CMAKE_PROGRESS_22 = 18
CMAKE_PROGRESS_23 = 20 CMAKE_PROGRESS_23 = 19
CMAKE_PROGRESS_24 = 21 CMAKE_PROGRESS_24 = 20
CMAKE_PROGRESS_25 = 22 CMAKE_PROGRESS_25 = 21
CMAKE_PROGRESS_26 = 23 CMAKE_PROGRESS_26 = 22
CMAKE_PROGRESS_27 = CMAKE_PROGRESS_27 = 23
CMAKE_PROGRESS_28 = 24 CMAKE_PROGRESS_28 =
CMAKE_PROGRESS_29 = 25 CMAKE_PROGRESS_29 = 24
CMAKE_PROGRESS_30 = 26 CMAKE_PROGRESS_30 = 25
CMAKE_PROGRESS_31 = 27 CMAKE_PROGRESS_31 = 26
CMAKE_PROGRESS_32 = 28 CMAKE_PROGRESS_32 = 27
CMAKE_PROGRESS_33 = 29 CMAKE_PROGRESS_33 = 28
CMAKE_PROGRESS_34 = 30 CMAKE_PROGRESS_34 = 29
CMAKE_PROGRESS_35 = CMAKE_PROGRESS_35 =
CMAKE_PROGRESS_36 = 31 CMAKE_PROGRESS_36 = 30
CMAKE_PROGRESS_37 = 32 CMAKE_PROGRESS_37 = 31
CMAKE_PROGRESS_38 = 33 CMAKE_PROGRESS_38 = 32
CMAKE_PROGRESS_39 = 34 CMAKE_PROGRESS_39 = 33
CMAKE_PROGRESS_40 = 35 CMAKE_PROGRESS_40 = 34
CMAKE_PROGRESS_41 = 36 CMAKE_PROGRESS_41 = 35
CMAKE_PROGRESS_42 = 37 CMAKE_PROGRESS_42 =
CMAKE_PROGRESS_43 = 38 CMAKE_PROGRESS_43 = 36
CMAKE_PROGRESS_44 = CMAKE_PROGRESS_44 = 37
CMAKE_PROGRESS_45 = 39 CMAKE_PROGRESS_45 = 38
CMAKE_PROGRESS_46 = 40 CMAKE_PROGRESS_46 = 39
CMAKE_PROGRESS_47 = 41 CMAKE_PROGRESS_47 = 40
CMAKE_PROGRESS_48 = 42 CMAKE_PROGRESS_48 = 41
CMAKE_PROGRESS_49 = 43 CMAKE_PROGRESS_49 =
CMAKE_PROGRESS_50 = 44 CMAKE_PROGRESS_50 = 42
CMAKE_PROGRESS_51 = 45 CMAKE_PROGRESS_51 = 43
CMAKE_PROGRESS_52 = 46 CMAKE_PROGRESS_52 = 44
CMAKE_PROGRESS_53 = CMAKE_PROGRESS_53 = 45
CMAKE_PROGRESS_54 = 47 CMAKE_PROGRESS_54 = 46
CMAKE_PROGRESS_55 = 48 CMAKE_PROGRESS_55 = 47
CMAKE_PROGRESS_56 = 49 CMAKE_PROGRESS_56 =
CMAKE_PROGRESS_57 = 50 CMAKE_PROGRESS_57 = 48
CMAKE_PROGRESS_58 = 51 CMAKE_PROGRESS_58 = 49
CMAKE_PROGRESS_59 = 52 CMAKE_PROGRESS_59 = 50
CMAKE_PROGRESS_60 = 53 CMAKE_PROGRESS_60 = 51
CMAKE_PROGRESS_61 = CMAKE_PROGRESS_61 = 52
CMAKE_PROGRESS_62 = 54 CMAKE_PROGRESS_62 =
CMAKE_PROGRESS_63 = 55 CMAKE_PROGRESS_63 = 53
CMAKE_PROGRESS_64 = 56 CMAKE_PROGRESS_64 = 54
CMAKE_PROGRESS_65 = 57 CMAKE_PROGRESS_65 = 55
CMAKE_PROGRESS_66 = 58 CMAKE_PROGRESS_66 = 56
CMAKE_PROGRESS_67 = 59 CMAKE_PROGRESS_67 = 57
CMAKE_PROGRESS_68 = 60 CMAKE_PROGRESS_68 = 58
CMAKE_PROGRESS_69 = 61 CMAKE_PROGRESS_69 =
CMAKE_PROGRESS_70 = CMAKE_PROGRESS_70 = 59
CMAKE_PROGRESS_71 = 62 CMAKE_PROGRESS_71 = 60
CMAKE_PROGRESS_72 = 63 CMAKE_PROGRESS_72 = 61
CMAKE_PROGRESS_73 = 64 CMAKE_PROGRESS_73 = 62
CMAKE_PROGRESS_74 = 65 CMAKE_PROGRESS_74 = 63
CMAKE_PROGRESS_75 = 66 CMAKE_PROGRESS_75 = 64
CMAKE_PROGRESS_76 = 67 CMAKE_PROGRESS_76 =
CMAKE_PROGRESS_77 = 68 CMAKE_PROGRESS_77 = 65
CMAKE_PROGRESS_78 = 69 CMAKE_PROGRESS_78 = 66
CMAKE_PROGRESS_79 = CMAKE_PROGRESS_79 = 67
CMAKE_PROGRESS_80 = 70 CMAKE_PROGRESS_80 = 68
CMAKE_PROGRESS_81 = 71 CMAKE_PROGRESS_81 = 69
CMAKE_PROGRESS_82 = 72 CMAKE_PROGRESS_82 = 70
CMAKE_PROGRESS_83 = 73 CMAKE_PROGRESS_83 =
CMAKE_PROGRESS_84 = 74 CMAKE_PROGRESS_84 = 71
CMAKE_PROGRESS_85 = 75 CMAKE_PROGRESS_85 = 72
CMAKE_PROGRESS_86 = 76 CMAKE_PROGRESS_86 = 73
CMAKE_PROGRESS_87 = CMAKE_PROGRESS_87 = 74
CMAKE_PROGRESS_88 = 77 CMAKE_PROGRESS_88 = 75
CMAKE_PROGRESS_89 = 78 CMAKE_PROGRESS_89 = 76
CMAKE_PROGRESS_90 = 79 CMAKE_PROGRESS_90 =
CMAKE_PROGRESS_91 = 80 CMAKE_PROGRESS_91 = 77
CMAKE_PROGRESS_92 = 81 CMAKE_PROGRESS_92 = 78
CMAKE_PROGRESS_93 = 82 CMAKE_PROGRESS_93 = 79
CMAKE_PROGRESS_94 = 83 CMAKE_PROGRESS_94 = 80
CMAKE_PROGRESS_95 = 84 CMAKE_PROGRESS_95 = 81
CMAKE_PROGRESS_96 = CMAKE_PROGRESS_96 = 82
CMAKE_PROGRESS_97 = 85 CMAKE_PROGRESS_97 =
CMAKE_PROGRESS_98 = 86 CMAKE_PROGRESS_98 = 83
CMAKE_PROGRESS_99 = 87 CMAKE_PROGRESS_99 = 84
CMAKE_PROGRESS_100 = 88 CMAKE_PROGRESS_100 = 85
CMAKE_PROGRESS_101 = 89 CMAKE_PROGRESS_101 = 86
CMAKE_PROGRESS_102 = 90 CMAKE_PROGRESS_102 = 87
CMAKE_PROGRESS_103 = 91 CMAKE_PROGRESS_103 = 88
CMAKE_PROGRESS_104 = 92 CMAKE_PROGRESS_104 =
CMAKE_PROGRESS_105 = CMAKE_PROGRESS_105 = 89
CMAKE_PROGRESS_106 = 93 CMAKE_PROGRESS_106 = 90
CMAKE_PROGRESS_107 = 94 CMAKE_PROGRESS_107 = 91
CMAKE_PROGRESS_108 = 95 CMAKE_PROGRESS_108 = 92
CMAKE_PROGRESS_109 = 96 CMAKE_PROGRESS_109 = 93
CMAKE_PROGRESS_110 = 97 CMAKE_PROGRESS_110 = 94
CMAKE_PROGRESS_111 = 98 CMAKE_PROGRESS_111 =
CMAKE_PROGRESS_112 = 99 CMAKE_PROGRESS_112 = 95
CMAKE_PROGRESS_113 = 100 CMAKE_PROGRESS_113 = 96
CMAKE_PROGRESS_114 = 97
CMAKE_PROGRESS_115 = 98
CMAKE_PROGRESS_116 = 99
CMAKE_PROGRESS_117 = 100
...@@ -3031,6 +3031,33 @@ model/WAgfInfo.cpp.s: ...@@ -3031,6 +3031,33 @@ model/WAgfInfo.cpp.s:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/model/WAgfInfo.cpp.s $(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/model/WAgfInfo.cpp.s
.PHONY : model/WAgfInfo.cpp.s .PHONY : model/WAgfInfo.cpp.s
zkH/HttpRequest.o: zkH/HttpRequest.cpp.o
.PHONY : zkH/HttpRequest.o
# target to build an object file
zkH/HttpRequest.cpp.o:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.o
.PHONY : zkH/HttpRequest.cpp.o
zkH/HttpRequest.i: zkH/HttpRequest.cpp.i
.PHONY : zkH/HttpRequest.i
# target to preprocess a source file
zkH/HttpRequest.cpp.i:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.i
.PHONY : zkH/HttpRequest.cpp.i
zkH/HttpRequest.s: zkH/HttpRequest.cpp.s
.PHONY : zkH/HttpRequest.s
# target to generate assembly for a file
zkH/HttpRequest.cpp.s:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/HttpRequest.cpp.s
.PHONY : zkH/HttpRequest.cpp.s
zkH/Register.o: zkH/Register.cpp.o zkH/Register.o: zkH/Register.cpp.o
.PHONY : zkH/Register.o .PHONY : zkH/Register.o
...@@ -3139,6 +3166,87 @@ zkH/inforMatch.cpp.s: ...@@ -3139,6 +3166,87 @@ zkH/inforMatch.cpp.s:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/inforMatch.cpp.s $(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/inforMatch.cpp.s
.PHONY : zkH/inforMatch.cpp.s .PHONY : zkH/inforMatch.cpp.s
zkH/myNotify.o: zkH/myNotify.cpp.o
.PHONY : zkH/myNotify.o
# target to build an object file
zkH/myNotify.cpp.o:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/myNotify.cpp.o
.PHONY : zkH/myNotify.cpp.o
zkH/myNotify.i: zkH/myNotify.cpp.i
.PHONY : zkH/myNotify.i
# target to preprocess a source file
zkH/myNotify.cpp.i:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/myNotify.cpp.i
.PHONY : zkH/myNotify.cpp.i
zkH/myNotify.s: zkH/myNotify.cpp.s
.PHONY : zkH/myNotify.s
# target to generate assembly for a file
zkH/myNotify.cpp.s:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/myNotify.cpp.s
.PHONY : zkH/myNotify.cpp.s
zkH/myProducer.o: zkH/myProducer.cpp.o
.PHONY : zkH/myProducer.o
# target to build an object file
zkH/myProducer.cpp.o:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/myProducer.cpp.o
.PHONY : zkH/myProducer.cpp.o
zkH/myProducer.i: zkH/myProducer.cpp.i
.PHONY : zkH/myProducer.i
# target to preprocess a source file
zkH/myProducer.cpp.i:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/myProducer.cpp.i
.PHONY : zkH/myProducer.cpp.i
zkH/myProducer.s: zkH/myProducer.cpp.s
.PHONY : zkH/myProducer.s
# target to generate assembly for a file
zkH/myProducer.cpp.s:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/myProducer.cpp.s
.PHONY : zkH/myProducer.cpp.s
zkH/subscribeNode.o: zkH/subscribeNode.cpp.o
.PHONY : zkH/subscribeNode.o
# target to build an object file
zkH/subscribeNode.cpp.o:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.o
.PHONY : zkH/subscribeNode.cpp.o
zkH/subscribeNode.i: zkH/subscribeNode.cpp.i
.PHONY : zkH/subscribeNode.i
# target to preprocess a source file
zkH/subscribeNode.cpp.i:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.i
.PHONY : zkH/subscribeNode.cpp.i
zkH/subscribeNode.s: zkH/subscribeNode.cpp.s
.PHONY : zkH/subscribeNode.s
# target to generate assembly for a file
zkH/subscribeNode.cpp.s:
$(MAKE) -f CMakeFiles/api-server.dir/build.make CMakeFiles/api-server.dir/zkH/subscribeNode.cpp.s
.PHONY : zkH/subscribeNode.cpp.s
zkH/zk_cpp.o: zkH/zk_cpp.cpp.o zkH/zk_cpp.o: zkH/zk_cpp.cpp.o
.PHONY : zkH/zk_cpp.o .PHONY : zkH/zk_cpp.o
...@@ -3524,6 +3632,9 @@ help: ...@@ -3524,6 +3632,9 @@ help:
@echo "... model/WAgfInfo.o" @echo "... model/WAgfInfo.o"
@echo "... model/WAgfInfo.i" @echo "... model/WAgfInfo.i"
@echo "... model/WAgfInfo.s" @echo "... model/WAgfInfo.s"
@echo "... zkH/HttpRequest.o"
@echo "... zkH/HttpRequest.i"
@echo "... zkH/HttpRequest.s"
@echo "... zkH/Register.o" @echo "... zkH/Register.o"
@echo "... zkH/Register.i" @echo "... zkH/Register.i"
@echo "... zkH/Register.s" @echo "... zkH/Register.s"
...@@ -3536,6 +3647,15 @@ help: ...@@ -3536,6 +3647,15 @@ help:
@echo "... zkH/inforMatch.o" @echo "... zkH/inforMatch.o"
@echo "... zkH/inforMatch.i" @echo "... zkH/inforMatch.i"
@echo "... zkH/inforMatch.s" @echo "... zkH/inforMatch.s"
@echo "... zkH/myNotify.o"
@echo "... zkH/myNotify.i"
@echo "... zkH/myNotify.s"
@echo "... zkH/myProducer.o"
@echo "... zkH/myProducer.i"
@echo "... zkH/myProducer.s"
@echo "... zkH/subscribeNode.o"
@echo "... zkH/subscribeNode.i"
@echo "... zkH/subscribeNode.s"
@echo "... zkH/zk_cpp.o" @echo "... zkH/zk_cpp.o"
@echo "... zkH/zk_cpp.i" @echo "... zkH/zk_cpp.i"
@echo "... zkH/zk_cpp.s" @echo "... zkH/zk_cpp.s"
......
No preview for this file type
{ {
"ipv4Address": "192.168.0.0", "ipv4Addresses": [
"192.168.0.0"
],
"nfInstanceId": "duklAMF", "nfInstanceId": "duklAMF",
"nfServices": [ "nfServices": [
{ {
......
No preview for this file type
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <regex> #include <regex>
#include "NFService.h" #include "NFService.h"
#include <vector> #include <vector>
//#include "myProducer.h"
namespace org { namespace org {
namespace openapitools { namespace openapitools {
...@@ -43,7 +44,7 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance(const std::string &nfInstanceI ...@@ -43,7 +44,7 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance(const std::string &nfInstanceI
response.send(Pistache::Http::Code::Ok, "Do some magic\n"); response.send(Pistache::Http::Code::Ok, "Do some magic\n");
} }
void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response,nlohmann::json &j0/*最后添加一个*/) { void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response,nlohmann::json &j0, std::string URI/*最后添加两个*/) {
//得到TXT //得到TXT
printf("接收到http请求!\n"); printf("接收到http请求!\n");
//转换成json信息 //转换成json信息
...@@ -161,8 +162,12 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst ...@@ -161,8 +162,12 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst
//j.at("nfType").get_to(nfType); //j.at("nfType").get_to(nfType);
std::string path; std::string path;
std::string fullPath; std::string fullPath;
std::string subscribePath;
std::string subscribeFullPath;
path = source + nfType;//初始化2级节点 path = source + nfType;//初始化2级节点
fullPath = path + "/" + nfInstanceId ;//fullPath是每一个实例的全部路径,包含关键信息 fullPath = path + "/" + nfInstanceId ;//fullPath是每一个实例的全部路径,包含关键信息
subscribePath = "/Subscribes/" + nfType;
subscribeFullPath = subscribePath + "/" + nfInstanceId;
cout << " path: " << path << endl; cout << " path: " << path << endl;
bool b; bool b;
/* /*
...@@ -174,7 +179,10 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst ...@@ -174,7 +179,10 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst
/*初始化二级节点用 b = Register.registerZK("", path, zk); */ /*初始化二级节点用 b = Register.registerZK("", path, zk); */
/**/ /**/
std::string getValue; std::string getValue;
//std::string subscribeGetValue;
utility::zoo_rc getRet = zk->get_node(path.c_str(), getValue, nullptr, true);//取出type节点下的信息放在getValue中 utility::zoo_rc getRet = zk->get_node(path.c_str(), getValue, nullptr, true);//取出type节点下的信息放在getValue中
//utility::zoo_rc subscribeGetRet = zk->get_node(subscribePath.c_str(), subscribeGetValue, nullptr, true);
//查看是否已经注册 //查看是否已经注册
utility::zoo_rc ret = zk->exists_node(fullPath.c_str(), nullptr, true); utility::zoo_rc ret = zk->exists_node(fullPath.c_str(), nullptr, true);
bool matchFlag; bool matchFlag;
...@@ -183,13 +191,34 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst ...@@ -183,13 +191,34 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst
if(matchFlag == 1){ if(matchFlag == 1){
ret = zk->delete_node(fullPath.c_str(), -1); ret = zk->delete_node(fullPath.c_str(), -1);
b = Register.registerZK(InforValue, fullPath, zk); b = Register.registerZK(InforValue, fullPath, zk);
std::cout << "已注册过的情况"<< std::endl; std::cout << "已注册过的情况"<< std::endl;
//执行发布NF_PROFILE_CHANGED的任务
/*myProducer *MyProducer = new myProducer;
std::string bufString = "I AM NF_PROFILE_CHANGED!";
int produceFlag = MyProducer->produceMessage(bufString);
free(MyProducer);*/
//notify.notifySomeone( fullPath不加subscribe的节点path);给出更新profile的节点,查询订阅了相应节点和type的订阅信息,直接通知
myNotify *MyNotify = new myNotify;
bool testMyNotify = MyNotify->notifySomeone(fullPath, 2);
} }
else{ else{
getValue = getValue + nfInstanceId + ";"; getValue = getValue + nfInstanceId + ";";
utility::zoo_rc setRet = zk->set_node(path.c_str(), getValue, -1); utility::zoo_rc setRet = zk->set_node(path.c_str(), getValue, -1);
b = Register.registerZK(InforValue, fullPath, zk); b = Register.registerZK(InforValue, fullPath, zk);//set在nftype等级节点下的instace节点
std::cout << "首次注册的情况" << std::endl; //subscribeGetValue = subscribeGetValue + nfInstanceId + ";";
//utility::zoo_rc setSubscribeRet = zk->set_node( subscribePath.c_str(), subscribeGetValue, -1);
b = Register.registerZK(";", subscribeFullPath, zk);//set在Subscribe等级节点下的instance节点
URI = URI + ';';
utility::zoo_rc setSubscribeURI = zk->set_node(subscribeFullPath.c_str(), URI, -1);//给Subscribe下的节点一个初始的自身URI标识
std::cout << "首次注册的情况"<< std::endl;
//执行发布NF_REGISTERED的任务
/*myProducer *MyProducer = new myProducer;
std::string bufString = "I AM NF_REGISTERED!";
int produceFlag = MyProducer->produceMessage(bufString);
free(MyProducer);*/
} }
//getValue = getValue + nfInstanceId + ";"; //getValue = getValue + nfInstanceId + ";";
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "discoverInformation.h" #include "discoverInformation.h"
#include "myNotify.h"
namespace org { namespace org {
namespace openapitools { namespace openapitools {
namespace server { namespace server {
...@@ -49,7 +50,7 @@ public: ...@@ -49,7 +50,7 @@ public:
void deregister_nf_instance(const std::string &nfInstanceID, Pistache::Http::ResponseWriter &response); void deregister_nf_instance(const std::string &nfInstanceID, Pistache::Http::ResponseWriter &response);
void get_nf_instance(const std::string &nfInstanceID, Pistache::Http::ResponseWriter &response); void get_nf_instance(const std::string &nfInstanceID, Pistache::Http::ResponseWriter &response);
void register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &j0); void register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &j0, std::string URI);
void update_nf_instance(const std::string &nfInstanceID, const std::vector<PatchItem> &patchItem, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response); void update_nf_instance(const std::string &nfInstanceID, const std::vector<PatchItem> &patchItem, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response);
}; };
......
...@@ -23,8 +23,55 @@ SubscriptionsCollectionApiImpl::SubscriptionsCollectionApiImpl(std::shared_ptr<P ...@@ -23,8 +23,55 @@ SubscriptionsCollectionApiImpl::SubscriptionsCollectionApiImpl(std::shared_ptr<P
: SubscriptionsCollectionApi(rtr) : SubscriptionsCollectionApi(rtr)
{ } { }
void SubscriptionsCollectionApiImpl::create_subscription(const SubscriptionData &subscriptionData, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response) { void SubscriptionsCollectionApiImpl::create_subscription(const SubscriptionData &subscriptionData, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &jSubscriptionData) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n"); nlohmann::json subscriptionDataJson = jSubscriptionData;
std::cout << "进来的json为 : " << subscriptionDataJson << std::endl;
/*下面对json信息进行处理*/
//取出返回URI
std::string nfStatusNotificationUriString = subscriptionDataJson.at("nfStatusNotificationUri").dump();
nfStatusNotificationUriString.erase(remove(nfStatusNotificationUriString.begin(), nfStatusNotificationUriString.end(), '\"'), nfStatusNotificationUriString.end());//删掉了前后的引号
std::cout << "nfStatusNotificationUriString is : " << nfStatusNotificationUriString << std::endl;
//首先是查看订阅了什么
if(subscriptionDataJson.contains("NfInstanceIdCond")){
//订阅单个NF
std::string NfInstanceId = subscriptionDataJson.at("NfInstanceIdCond").dump();
NfInstanceId.erase(remove(NfInstanceId.begin(), NfInstanceId.end(), '\"'), NfInstanceId.end());//删掉了前后的引号
subscribeNode *SubscribeNode = new subscribeNode;
//getChildPath *GetChildPath = new getChildPath;
std::string childFullPath = SubscribeNode->getFullPath(NfInstanceId);
std::cout << "ChildFullPath is :" << childFullPath << std::endl;
//free(GetChildPath);
//从之前获得的路径获取subscribe下的订阅信息
//subscribeNode *SubscribeNode = new subscribeNode;
bool setSubFlag = SubscribeNode->setSubscribeURI(nfStatusNotificationUriString , childFullPath);//输入的childFullPath并不包含一级节点Subscribe
free(SubscribeNode);
}
else if(subscriptionDataJson.contains("NfTypeCond")){
//订阅了一个type
}
else if(subscriptionDataJson.contains("ServiceNameCond")){
//订阅了一种serviceName
}
else if(subscriptionDataJson.contains("AmfCond")){
//订阅了某个AMF集或某AMF区域的一组NF实例
}
else if(subscriptionDataJson.contains("GuamiListCond")){
//订阅了由Guamis确定的一组NF实例
}
else if (subscriptionDataJson.contains("NetworkSliceCond")){
//订阅了由S-NSSAI和NSIID标识的一组NF实例
}
else if(subscriptionDataJson.contains("NfGroupCond")){
//订阅了由NF组标标识的一组NF实例
}
else{
//订阅全部NF
}
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
} }
} }
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "SubscriptionData.h" #include "SubscriptionData.h"
#include <string> #include <string>
//#include "getChildPath.h"
#include "subscribeNode.h"
namespace org { namespace org {
namespace openapitools { namespace openapitools {
...@@ -45,7 +47,7 @@ public: ...@@ -45,7 +47,7 @@ public:
SubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>); SubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>);
~SubscriptionsCollectionApiImpl() {} ~SubscriptionsCollectionApiImpl() {}
void create_subscription(const SubscriptionData &subscriptionData, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response); void create_subscription(const SubscriptionData &subscriptionData, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw> &acceptEncoding, Pistache::Http::ResponseWriter &response, nlohmann::json &jSubscriptionData);
}; };
...@@ -56,4 +58,4 @@ public: ...@@ -56,4 +58,4 @@ public:
#endif #endif
\ No newline at end of file
librdkafka++.so.1
\ No newline at end of file
librdkafka.so.1
\ No newline at end of file
This diff is collapsed.
#ifndef __HTTP__
#define __HTTP__
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <netdb.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#define BUFSIZE 41000
#define URLSIZE 1024
#define INVALID_SOCKET -1
#define __DEBUG__
class HttpRequest
{
public:
HttpRequest();
~HttpRequest();
void DebugOut(const char *fmt, ...);
int HttpGet(const char* strUrl, char* strResponse);
int HttpPost(const char* strUrl, const char* strData, char* strResponse);
private:
int HttpRequestExec(const char* strMethod, const char* strUrl, const char* strData, char* strResponse);
char* HttpHeadCreate(const char* strMethod, const char* strUrl, const char* strData);
char* HttpDataTransmit(char *strHttpHead, const int iSockFd);
int GetPortFromUrl(const char* strUrl);
char* GetIPFromUrl(const char* strUrl);
char* GetParamFromUrl(const char* strUrl);
char* GetHostAddrFromUrl(const char* strUrl);
int SocketFdCheck(const int iSockFd);
static int m_iSocketFd;
};
#endif
\ No newline at end of file
#include "myNotify.h"
#include <stdio.h>
#include <iostream>
#include "zookeeperClient.h"
#include "get2rdNodeMessage.h"
#include "HttpRequest.h"
#include <nlohmann/json.hpp>
#include <pthread.h>
bool myNotify::notifySomeone(std::string fullPath, int notificationEventType){
zookeeperClient zooK;
std::string testFullPath;
std::string returnFullPath;
bool a = zooK.connect2ZKServer("192.168.211.128:2181");
utility::zk_cpp* zk;
zk = zooK.getZk();
utility::zoo_rc ret = utility::z_ok;
//已连接zookeeper,fullPath存储着不包含subscribe的二级节点路径
//接下来要取出profile备用
int i = 0;
for(int j = 0; i < fullPath.size(); i++){
if(fullPath[i] == '/') j++;
if(j == 2) break;//此时i存着fullPath里第二个斜杠的位置
}
std::string oneInstanceId = fullPath;
oneInstanceId.erase(0,i+1);
oneInstanceId = oneInstanceId + ".json";
std::ifstream readProfile(oneInstanceId);
nlohmann::json thisProfileJson;
readProfile>> thisProfileJson;
std::string thisProfileString = thisProfileJson.dump();//取出这个instance的profile备用
std::string subscribeFullPath = "/Subscribes" + fullPath;
std::cout << "subscribeFullPath is :" << subscribeFullPath << std::endl;
std::string subscribeNftypePath;
i = 0;
for(int j = 0; i < subscribeFullPath.size(); i++){
if(subscribeFullPath[i] == '/') j++;
if(j == 3) break;
}
subscribeNftypePath = subscribeFullPath;
subscribeNftypePath.erase(i);//截取得出带有subscribe节点的nftype节点路径
//std::cout << "subscribeNftypePath is : " << subscribeNftypePath << std::endl;
//subscribeNftypePath已获取Subscribe+type的节点path
/*先给订阅instance的发送*/
//首先要获取叶子节点下存储的订阅的信息
get2rdNodeMessage *Get2rdNodeMessage = new get2rdNodeMessage;
std::cout << "subscribeFullPath is : " << subscribeFullPath << std::endl;
std::string instanceSubscriberString = Get2rdNodeMessage->getNodeMessage(subscribeFullPath);
std::cout << "instanceSubscriberString is : " << instanceSubscriberString << std::endl;//已取出叶子节点订阅信息
//string转char数组,检验分号";",转化为单个string
int instanceSubscriberStringSize = instanceSubscriberString.size();
char instanceSubscriberChar[instanceSubscriberStringSize];
instanceSubscriberString.erase(0,1);//去掉初始化的一个分号
std::cout << "instanceSubscriberString is : " << instanceSubscriberString << std::endl;
strcpy(instanceSubscriberChar, instanceSubscriberString.c_str());
int ArraySubscript = 0;
std::string oneOfSubscribeURI;
int numberflag = 0;
std::string thisInstanceURI;
for( ; ArraySubscript < instanceSubscriberStringSize ; ArraySubscript++){
if(instanceSubscriberChar[ArraySubscript] != 59){
std::string s(instanceSubscriberString, ArraySubscript, 1);
oneOfSubscribeURI = oneOfSubscribeURI + s;
}
else{
/*遇到分号了,此时oneOfSubscribeURI包含上一个URI,即192.168.211.128:9093/nnrf-nfm/v1/nfinstances/duklAMF*/
/*接下来处理URI,拆分成三段,ip/端口和URL,即查找冒号以及第一个斜杠*/
if(numberflag == 0) {
thisInstanceURI = oneOfSubscribeURI;
std::cout << "thisInstanceURI is : " << thisInstanceURI <<std::endl;
numberflag = 1;
}
else{
std::cout << "oneOfSubscribeURI is : " << oneOfSubscribeURI << std::endl;
HttpRequest* Http = new HttpRequest;
char* str = (char*)malloc(BUFSIZE);
memset(str, 0, BUFSIZE);
std::string strData;
strData = "{\"event\":\"";
if(notificationEventType == 0) {
strData = strData + "NF_REGISTERED\"";/* {"event":"NF_REGISTERED" */
strData = strData + ',' + "\"nfInstanceUri\"" + ':' + '"' + thisInstanceURI + '"' + '}';
}
else if(notificationEventType == 1){
}
else if(notificationEventType == 2){
strData = strData + "NF_PROFILE_CHANGED\"";/* {"event":"NF_PROFILE_CHANGED" */
strData = strData + ',' + "\"nfInstanceUri\"" + ':' + '"' + thisInstanceURI + "\",\"";/* {"event":"NF_PROFILE_CHANGED","nfInstanceUri":"***"," */
strData = strData + "nfProfile\"" + ':' + thisProfileString + '}';
};
if(Http->HttpRequest::HttpPost( oneOfSubscribeURI.c_str(), strData.c_str() , str ) ) {
printf("%s\n", str);
}
else{
printf("Http请求失败\n");
};
}
oneOfSubscribeURI = "";
//free(Http);
}
}//某一个instance实例下的uri发送完毕
/*再给订阅这个type的URI发*/
std::string NftypeSubscriberString = Get2rdNodeMessage->getNodeMessage(subscribeNftypePath);
std::cout << "NftypeSubscriberString is : " << NftypeSubscriberString << std::endl;
int NftypeSubscriberStringSize = NftypeSubscriberString.size();
char NftypeSubscriberChar[NftypeSubscriberStringSize];
NftypeSubscriberString.erase(0,1);
strcpy(NftypeSubscriberChar, NftypeSubscriberString.c_str());
ArraySubscript = 0;
//std::string oneOfSubscribeURI;
for( ; ArraySubscript < NftypeSubscriberStringSize ; ArraySubscript++ ){
if(NftypeSubscriberChar[ArraySubscript] !=59 ){
std::string s(NftypeSubscriberString, ArraySubscript, 1);
oneOfSubscribeURI = oneOfSubscribeURI + s;
}
else{
std::cout << "oneOfSubscribeURI is : " << oneOfSubscribeURI << std::endl;
HttpRequest* Http = new HttpRequest;
char* str = (char*)malloc(BUFSIZE);
memset(str, 0, BUFSIZE);
if(Http->HttpRequest::HttpPost( oneOfSubscribeURI.c_str(), "NF_PROFILE_CHANGED" , str ) ) {
printf("%s\n", str);
}
else{
printf("Http请求失败\n");
}
oneOfSubscribeURI = "";
//free(Http);
}
}
return 0;
}
#include <string>
#include <stdbool.h>
#include <iostream>
#include <string>
#include <cstdlib>
class myNotify{
public:
bool notifySomeone(std::string fullPath, int notificationEventType);
};
#include "myProducer.h"
int myProducer::produceMessage(std::string bufString){
int argc = 3;
//char **argv;//启动producer的参数
char *a [] = {"./api-server","PLAINTEXT://192.168.211.128:9092","test_topic"};//记得改这个!!!!
char **argv = a;
rd_kafka_t *rk; /*Producer instance handle*/
rd_kafka_topic_t *rkt; /*topic对象*/
rd_kafka_conf_t *conf; /*临时配置对象*/
char errstr[512];
char buf[512];
const char *brokers;
const char *topic;
if(argc != 3){
//fprintf(stderr, "%% Usage: %s <broker> <topic>\n", argv[0]);
return 1;
}
brokers = argv[1];
topic = argv[2];
/* 创建一个kafka配置占位 */
conf = rd_kafka_conf_new();
/*创建broker集群*/
if (rd_kafka_conf_set(conf, "bootstrap.servers", brokers, errstr,
sizeof(errstr)) != RD_KAFKA_CONF_OK){
fprintf(stderr, "%s\n", errstr);
return 1;
}
/*设置发送报告回调函数,rd_kafka_produce()接收的每条消息都会调用一次该回调函数
*应用程序需要定期调用rd_kafka_poll()来服务排队的发送报告回调函数*/
rd_kafka_conf_set_dr_msg_cb(conf, myProducer::dr_msg_cb);
/*创建producer实例
rd_kafka_new()获取conf对象的所有权,应用程序在此调用之后不得再次引用它*/
rk = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errstr, sizeof(errstr));
if(!rk){
fprintf(stderr, "%% Failed to create new producer:%s\n", errstr);
return 1;
}
/*实例化一个或多个topics(`rd_kafka_topic_t`)来提供生产或消费,topic
对象保存topic特定的配置,并在内部填充所有可用分区和leader brokers,*/
rkt = rd_kafka_topic_new(rk, topic, NULL);
if (!rkt){
fprintf(stderr, "%% Failed to create topic object: %s\n",
rd_kafka_err2str(rd_kafka_last_error()));
rd_kafka_destroy(rk);
return 1;
}
/*用于中断的信号*/
signal(SIGINT, myProducer::stop);
fprintf(stderr,
"%% Type some text and hit enter to produce message\n"
"%% Or just hit enter to only serve delivery reports\n"
"%% Press Ctrl-C or Ctrl-D to exit\n");
//while(run && fgets(buf, sizeof(buf), stdin)){
//buf = bufString.c_str();将输入的字符转成发布用的字符串
int flagBuf = 0;
for(;flagBuf < bufString.length(); flagBuf++){
buf[flagBuf] = bufString[flagBuf];
}
buf[flagBuf] = '\0';
size_t len = strlen(buf);
if(buf[len-1] == '\n')
buf[--len] = '\0';
if(len == 0){
/*轮询用于事件的kafka handle,
事件将导致应用程序提供的回调函数被调用
第二个参数是最大阻塞时间,如果设为0,将会是非阻塞的调用*/
rd_kafka_poll(rk, 0);
}
retry:
/*Send/Produce message.
这是一个异步调用,在成功的情况下,只会将消息排入内部producer队列,
对broker的实际传递尝试由后台线程处理,之前注册的传递回调函数(dr_msg_cb)
用于在消息传递成功或失败时向应用程序发回信号*/
if (rd_kafka_produce(
/* Topic object */
rkt,
/*使用内置的分区来选择分区*/
RD_KAFKA_PARTITION_UA,
/*生成payload的副本*/
RD_KAFKA_MSG_F_COPY,
/*消息体和长度*/
buf, len,
/*可选键及其长度*/
NULL, 0,
NULL) == -1){
fprintf(stderr,
"%% Failed to produce to topic %s: %s\n",
rd_kafka_topic_name(rkt),
rd_kafka_err2str(rd_kafka_last_error()));
if (rd_kafka_last_error() == RD_KAFKA_RESP_ERR__QUEUE_FULL){
/*如果内部队列满,等待消息传输完成并retry,
内部队列表示要发送的消息和已发送或失败的消息,
内部队列受限于queue.buffering.max.messages配置项*/
rd_kafka_poll(rk, 1000);
goto retry;
}
}else{
fprintf(stderr, "%% Enqueued message (%zd bytes) for topic %s\n",
len, rd_kafka_topic_name(rkt));
}
/*producer应用程序应不断地通过以频繁的间隔调用rd_kafka_poll()来为
传送报告队列提供服务。在没有生成消息以确定先前生成的消息已发送了其
发送报告回调函数(和其他注册过的回调函数)期间,要确保rd_kafka_poll()
仍然被调用*/
rd_kafka_poll(rk, 0);
// }
fprintf(stderr, "%% Flushing final message.. \n");
/*rd_kafka_flush是rd_kafka_poll()的抽象化,
等待所有未完成的produce请求完成,通常在销毁producer实例前完成
以确保所有排列中和正在传输的produce请求在销毁前完成*/
rd_kafka_flush(rk, 10*1000);
/* Destroy topic object */
rd_kafka_topic_destroy(rkt);
/* Destroy the producer instance */
rd_kafka_destroy(rk);
std::cout << "发布执行完毕!" << std::endl;
return 0;
}
#include <stdio.h>
#include <signal.h>
#include <string>
#include <cstring>
#include <iostream>
#include "/usr/local/include/librdkafka/rdkafka.h"
class myProducer{
public:
//int run = 1;
int produceMessage(std::string bufString);
static void stop(int sig){
// run = 0;
fclose(stdin);
}
/*
每条消息调用一次该回调函数,说明消息是传递成功(rkmessage->err == RD_KAFKA_RESP_ERR_NO_ERROR)
还是传递失败(rkmessage->err != RD_KAFKA_RESP_ERR_NO_ERROR)
该回调函数由rd_kafka_poll()触发,在应用程序的线程上执行
*/
static void dr_msg_cb(rd_kafka_t *rk,
const rd_kafka_message_t *rkmessage, void *opaque){
if(rkmessage->err)
fprintf(stderr, "%% Message delivery failed: %s\n",
rd_kafka_err2str(rkmessage->err));
else
fprintf(stderr,
"%% Message delivered (%zd bytes , " " partition %"PRId32")\n",
rkmessage->len, rkmessage->partition);
/* rkmessage被librdkafka自动销毁*/
// int produceMessage(std::string bufString);
}
};
#include "subscribeNode.h"
bool subscribeNode::setSubscribeURI(std::string URI, std::string leafPath){
zookeeperClient zooK;
std::string testFullPath;
std::string returnFullPath;
bool a = zooK.connect2ZKServer("192.168.211.128:2181");
utility::zk_cpp* zk;
zk = zooK.getZk();
utility::zoo_rc ret = utility::z_ok;
//初始化zookeeper
std::string getValue;
leafPath = "/Subscribes" + leafPath;
utility::zoo_rc getRet = zk->get_node(leafPath.c_str(), getValue, nullptr, true);
std::string setValue = getValue + URI + ";";
std::cout << "leafPath is : " << leafPath << std::endl;
utility::zoo_rc setRet = zk->set_node(leafPath.c_str(), setValue, -1);
std::cout << "set完毕" << std::endl;
return 1;
}
std::string subscribeNode::getFullPath(std::string leafPath){
zookeeperClient zooK;
std::string testFullPath;
std::string returnFullPath;
bool a = zooK.connect2ZKServer("192.168.211.128:2181");
utility::zk_cpp* zk;
zk = zooK.getZk();
utility::zoo_rc ret = utility::z_ok;
//鍒濆鍖杬ookeeper缁撴潫
testFullPath = "/AMF/" + leafPath;
//std::cout << "testFullPath is : " << testFullPath << std::endl;
ret = zk->exists_node(testFullPath.c_str(), nullptr, true);
if(ret == utility::z_ok){
returnFullPath = testFullPath;
return returnFullPath;
}
testFullPath = "/SMF/" + leafPath;
//std::cout << "testFullPath is : " << testFullPath << std::endl;
ret = zk->exists_node(testFullPath.c_str(), nullptr, true);
if(ret == utility::z_ok){
returnFullPath = testFullPath;
return returnFullPath;
}
returnFullPath = "NO SUCH NFTYPE!";
return returnFullPath;
}
#include <string>
#include <stdbool.h>
#include "zookeeperClient.h"
class subscribeNode{
public:
bool setSubscribeURI(std::string URI, std::string leafPath);
std::string getFullPath(std::string leafPath);
};
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