浏览代码

#IQRV #comment [libPublicFunc] 移除Ping的功能到 Restfunc

gifur 3 年之前
父节点
当前提交
e81fb3acae

+ 1 - 0
Other/libRestfulFunc/CMakeLists.txt

@@ -5,6 +5,7 @@ set(${MODULE_PREFIX}_SRCS
     RestfulFunc.h
     RestfulFuncImpl.cpp
     HttpProbeImpl.cpp
+    PingImpl.cpp
 )
 
 add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})

+ 2 - 2
Other/libpublicFun/ping.cpp → Other/libRestfulFunc/PingImpl.cpp

@@ -4,7 +4,7 @@
 // 
 //
 
-#include "publicFunExport.h"
+#include "RestfulFunc.h"
 #include<sys/socket.h>
 #include<sys/types.h>
 #include<netinet/in.h>
@@ -127,7 +127,7 @@ u_short api_checksum16(u_short *buffer, int size)
     return (u_short)(~cksum);
 }
 
-int Ping(const std::string& dst_ip)
+int PingTest(const std::string& dst_ip)
 {
     int ret = FAILURE;
     int sd = 0;

+ 9 - 0
Other/libRestfulFunc/RestfulFunc.h

@@ -30,4 +30,13 @@
 */
 RESTFULFUNC_API int HttpProbe(const std::string& url, std::string& out_msg, uint32_t wait_max_secs = (uint32_t)-1);
 
+
+/*!
+ * @brief Ping protocols
+ * @param[in]
+ * @param[out]
+ * @return : 0: ping connect succ; 1: ping failed
+ */
+RESTFULFUNC_API int PingTest(const std::string& dst_ip);
+
 #endif //_OTHER_RESFULFUNCEXPORT_HEADER_

+ 2 - 2
Other/libpublicFun/test/testPing.cpp → Other/libRestfulFunc/test/testPing.cpp

@@ -1,10 +1,10 @@
 #define CATCH_CONFIG_MAIN
 #include <catch2.hpp>
-#include "publicFunExport.h"
+#include "RestfulFunc.h"
 
 TEST_CASE("Test ping protocols implement", "[normal]")
 {
-    REQUIRE(Ping("55.14.131.137") == 0);
+    REQUIRE(PingTest("55.14.131.137") == 0);
 
 }
 

+ 0 - 7
Other/libpublicFun/publicFunExport.h

@@ -49,11 +49,4 @@ public:
 	void Destory();
 };
 
-/*!
- * @brief Ping protocols
- * @param[in]  
- * @param[out] 
- * @return : 0: ping connect succ; 1: ping failed
- */
-PUBLIC_API int Ping(const std::string& dst_ip);
 #endif //_OTHER_PUBLICFUNCEXPORT_HEADER_