From 84183de1304880e9fe7da0f9630900c9cacebd63 Mon Sep 17 00:00:00 2001 From: jxw Date: Tue, 8 Jul 2025 06:43:37 +0000 Subject: [PATCH 01/14] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 31 +++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 1cd795d05..4a7faa6aa 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -371,6 +371,37 @@ NetConn_ErrorCode OH_NetConn_SetPacUrl(const char *pacUrl); * @since 15 */ NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); + +/** + * @brief Query a network probe result. + * + * @param destination Pointer to the destination. + * @param duration probe duration. Unit: second. + * @param probeResultInfo Pointer to probe loss rate and rtt. + * @return 0 - Success. + * 201 - Missing permissions. + * 401 - Parameter error. + * 2100003 - Internal error. + * @permission ohos.permission.INTERNET and ohos.permission.ACCESS_TRACE_ROUTE_INFO + * @since 20 + */ +int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn_ProbeResultInfo *probeResultInfo); + +/** + * @brief Query a network trace route. + * + * @param destination Pointer to the destination. + * @param option Pointer to the trace route option + * @param traceRouteInfo Pointer to trace route result. + * @return 0 - Success. + * 201 - Missing permissions. + * 401 - Parameter error. + * 2100003 - Internal error. + * @permission ohos.permission.INTERNET and ohos.permission.LOCATION and ohos.permission.ACCESS_TRACE_ROUTE_INFO + * @since 20 + */ +int32_t OH_NetConn_QueryTraceRoute(char *destination, NetConn_TraceRouteOption *option, NetConn_TraceRouteInfo *traceRouteInfo); + #ifdef __cplusplus } #endif -- Gitee From c90cbae4ba358eace132cc4702097c131f683def Mon Sep 17 00:00:00 2001 From: jxw Date: Tue, 8 Jul 2025 11:30:50 +0000 Subject: [PATCH 02/14] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 4a7faa6aa..a91fb4e3f 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -387,21 +387,6 @@ NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); */ int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn_ProbeResultInfo *probeResultInfo); -/** - * @brief Query a network trace route. - * - * @param destination Pointer to the destination. - * @param option Pointer to the trace route option - * @param traceRouteInfo Pointer to trace route result. - * @return 0 - Success. - * 201 - Missing permissions. - * 401 - Parameter error. - * 2100003 - Internal error. - * @permission ohos.permission.INTERNET and ohos.permission.LOCATION and ohos.permission.ACCESS_TRACE_ROUTE_INFO - * @since 20 - */ -int32_t OH_NetConn_QueryTraceRoute(char *destination, NetConn_TraceRouteOption *option, NetConn_TraceRouteInfo *traceRouteInfo); - #ifdef __cplusplus } #endif -- Gitee From a08de6f9a82206ff3bd0b79487663e43d75ba4eb Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 09:45:23 +0000 Subject: [PATCH 03/14] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index a91fb4e3f..8430ec9c2 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -382,7 +382,7 @@ NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); * 201 - Missing permissions. * 401 - Parameter error. * 2100003 - Internal error. - * @permission ohos.permission.INTERNET and ohos.permission.ACCESS_TRACE_ROUTE_INFO + * @permission ohos.permission.INTERNET * @since 20 */ int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn_ProbeResultInfo *probeResultInfo); -- Gitee From 1ffd80c5297f0a239ec2e2ee2f5ce3a396d4903e Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 10:11:24 +0000 Subject: [PATCH 04/14] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 8430ec9c2..aaf11f6e8 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -387,6 +387,22 @@ NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); */ int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn_ProbeResultInfo *probeResultInfo); +/** + * @brief Query a network trace route. + * + * @param destination Pointer to the destination. + * @param option Pointer to the trace route option + * @param traceRouteInfo Pointer to trace route result. + * @return 0 - Success. + * 201 - Missing permissions. + * 401 - Parameter error. + * 2100003 - Internal error. + * @permission ohos.permission.INTERNET and ohos.permission.LOCATION and ohos.permission.ACCESS_TRACE_ROUTE_INFO + * @since 20 + */ +int32_t OH_NetConn_QueryTraceRoute(char *destination, NetConn_TraceRouteOption *option, + NetConn_TraceRouteInfo *traceRouteInfo); + #ifdef __cplusplus } #endif -- Gitee From a77afe7bd01d72eb54102db1663acaee1eaa1827 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 13:07:44 +0000 Subject: [PATCH 05/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- .../netmanager/include/net_connection_type.h | 61 +++++++++++++++++-- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index 664656fd5..48318d967 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -13,6 +13,9 @@ * limitations under the License. */ +#ifndef NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + /** * @addtogroup NetConnection * @{ @@ -35,10 +38,6 @@ * */ -#ifndef NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - -#include #include #include @@ -53,6 +52,7 @@ extern "C" { #define NETCONN_MAX_ROUTE_SIZE 64 #define NETCONN_MAX_EXCLUSION_SIZE 256 #define NETCONN_MAX_STR_LEN 256 +#define NETCONN_MAX_RTT_NUM 4 /** * @brief Defines network capabilities. @@ -130,6 +130,18 @@ typedef enum NetConn_ErrorCode { NETCONN_INTERNAL_ERROR = 2100003 } NetConn_ErrorCode; +/** + * @brief Enumerates packets type of trace route. + * + * @since 20 + */ +typedef enum NetConn_PacketsType { + /** ICMP */ + NETCONN_PACKETS_ICMP = 0, + /** UDP */ + NETCONN_PACKETS_UDP = 1 +} NetConn_PacketsType; + /** * @brief Defines the network handle. * @@ -380,9 +392,48 @@ typedef struct NetConn_NetConnCallback { OH_NetConn_NetBlockStatusChange onNetBlockStatusChange; } NetConn_NetConnCallback; +/** + * @brief Defines the probe result information. + * + * @since 20 + */ +typedef struct NetConn_ProbeResultInfo { + /** Number of jumps */ + uint8_t lossRate; + /** RTT in micro seconds, min/avg/max/std */ + uint32_t rtt[NETCONN_MAX_RTT_NUM]; +} NetConn_ProbeResultInfo; + +/** + * @brief Defines the network trace route option. + * + * @since 20 + */ +typedef struct NetConn_TraceRouteOption { + /** Maximum number of jumps, default is 30 */ + uint8_t maxJumpNumber; + /** Port number */ + NetConn_PacketsType packetsType; +} NetConn_TraceRouteOption; + +/** + * @brief Defines the trace route information. + * + * @since 20 + */ +typedef struct NetConn_TraceRouteInfo { + /** Number of jumps */ + uint8_t JumpNo; + /** host name or address */ + char address[NETCONN_MAX_STR_LEN]; + /** RTT in micro seconds */ + uint32_t rtt[NETCONN_MAX_RTT_NUM]; +} NetConn_TraceRouteInfo; + + #ifdef __cplusplus } #endif /** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file +#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From 5886517256f3170e323b5d8ac8ca5759be6b8a46 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 13:09:33 +0000 Subject: [PATCH 06/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- network/netmanager/include/net_connection_type.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index 48318d967..09b55aad4 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - /** * @addtogroup NetConnection * @{ @@ -37,6 +34,8 @@ * @version 1.0 * */ +#ifndef NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H #include #include @@ -436,4 +435,4 @@ typedef struct NetConn_TraceRouteInfo { #endif /** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ +#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file -- Gitee From 476c8391f74a2f5c4f016ffe41242a7e8280c0f0 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 13:10:28 +0000 Subject: [PATCH 07/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- network/netmanager/include/net_connection_type.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index 09b55aad4..7994ffd86 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -34,9 +34,11 @@ * @version 1.0 * */ + #ifndef NATIVE_NET_CONN_TYPE_H #define NATIVE_NET_CONN_TYPE_H +#include #include #include -- Gitee From ca0d14049e8f757d768fec32a2dcaf570e70cdbd Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 13:12:00 +0000 Subject: [PATCH 08/14] update network/netmanager/libnet_connection.ndk.json. Signed-off-by: jxw --- network/netmanager/libnet_connection.ndk.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index 56325004e..ed2a16131 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -86,5 +86,13 @@ { "first_introduced": "15", "name": "OH_NetConn_GetPacUrl" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_QueryProbeResult" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_QueryTraceRoute" } ] \ No newline at end of file -- Gitee From 99ffc848f1294389143b30442d1447a9cf327da5 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 14:20:03 +0000 Subject: [PATCH 09/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- network/netmanager/include/net_connection_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index 7994ffd86..f4227cf81 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -400,7 +400,7 @@ typedef struct NetConn_NetConnCallback { */ typedef struct NetConn_ProbeResultInfo { /** Number of jumps */ - uint8_t lossRate; + uint8_t lossRate; /** RTT in micro seconds, min/avg/max/std */ uint32_t rtt[NETCONN_MAX_RTT_NUM]; } NetConn_ProbeResultInfo; @@ -424,7 +424,7 @@ typedef struct NetConn_TraceRouteOption { */ typedef struct NetConn_TraceRouteInfo { /** Number of jumps */ - uint8_t JumpNo; + uint8_t jumpNo; /** host name or address */ char address[NETCONN_MAX_STR_LEN]; /** RTT in micro seconds */ -- Gitee From 4d883aecb24bdd92e9ad2e73f49776cb66ee1592 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 14:38:01 +0000 Subject: [PATCH 10/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- network/netmanager/include/net_connection_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index f4227cf81..f50803f29 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -424,7 +424,7 @@ typedef struct NetConn_TraceRouteOption { */ typedef struct NetConn_TraceRouteInfo { /** Number of jumps */ - uint8_t jumpNo; + uint8_t JumpNo; /** host name or address */ char address[NETCONN_MAX_STR_LEN]; /** RTT in micro seconds */ -- Gitee From b3d60b556570bf4c53bf5db82e6ac9a1f68feb3a Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 15:22:17 +0000 Subject: [PATCH 11/14] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index aaf11f6e8..8430ec9c2 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -387,22 +387,6 @@ NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); */ int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn_ProbeResultInfo *probeResultInfo); -/** - * @brief Query a network trace route. - * - * @param destination Pointer to the destination. - * @param option Pointer to the trace route option - * @param traceRouteInfo Pointer to trace route result. - * @return 0 - Success. - * 201 - Missing permissions. - * 401 - Parameter error. - * 2100003 - Internal error. - * @permission ohos.permission.INTERNET and ohos.permission.LOCATION and ohos.permission.ACCESS_TRACE_ROUTE_INFO - * @since 20 - */ -int32_t OH_NetConn_QueryTraceRoute(char *destination, NetConn_TraceRouteOption *option, - NetConn_TraceRouteInfo *traceRouteInfo); - #ifdef __cplusplus } #endif -- Gitee From 0bfcd4af6f9681f9beef234b9c3674720dfa4140 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 15:23:02 +0000 Subject: [PATCH 12/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- .../netmanager/include/net_connection_type.h | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index f50803f29..c4c39cf8e 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -405,33 +405,6 @@ typedef struct NetConn_ProbeResultInfo { uint32_t rtt[NETCONN_MAX_RTT_NUM]; } NetConn_ProbeResultInfo; -/** - * @brief Defines the network trace route option. - * - * @since 20 - */ -typedef struct NetConn_TraceRouteOption { - /** Maximum number of jumps, default is 30 */ - uint8_t maxJumpNumber; - /** Port number */ - NetConn_PacketsType packetsType; -} NetConn_TraceRouteOption; - -/** - * @brief Defines the trace route information. - * - * @since 20 - */ -typedef struct NetConn_TraceRouteInfo { - /** Number of jumps */ - uint8_t JumpNo; - /** host name or address */ - char address[NETCONN_MAX_STR_LEN]; - /** RTT in micro seconds */ - uint32_t rtt[NETCONN_MAX_RTT_NUM]; -} NetConn_TraceRouteInfo; - - #ifdef __cplusplus } #endif -- Gitee From f14b829fe1e9ed5ccb0dda58b2277c711200ab50 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 15:23:37 +0000 Subject: [PATCH 13/14] update network/netmanager/libnet_connection.ndk.json. Signed-off-by: jxw --- network/netmanager/libnet_connection.ndk.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index ed2a16131..7d32accef 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -90,9 +90,5 @@ { "first_introduced": "20", "name": "OH_NetConn_QueryProbeResult" - }, - { - "first_introduced": "20", - "name": "OH_NetConn_QueryTraceRoute" } ] \ No newline at end of file -- Gitee From 0aa8e6bb736da4cbe77ab7282f82d5412e305274 Mon Sep 17 00:00:00 2001 From: jxw Date: Thu, 10 Jul 2025 15:26:32 +0000 Subject: [PATCH 14/14] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- network/netmanager/include/net_connection_type.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index c4c39cf8e..469153447 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -131,18 +131,6 @@ typedef enum NetConn_ErrorCode { NETCONN_INTERNAL_ERROR = 2100003 } NetConn_ErrorCode; -/** - * @brief Enumerates packets type of trace route. - * - * @since 20 - */ -typedef enum NetConn_PacketsType { - /** ICMP */ - NETCONN_PACKETS_ICMP = 0, - /** UDP */ - NETCONN_PACKETS_UDP = 1 -} NetConn_PacketsType; - /** * @brief Defines the network handle. * -- Gitee