From adb12773718e1842c0b44245f4d040051b8d404f Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 11 Jul 2025 03:14:53 +0000 Subject: [PATCH 1/5] 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 707d5959747a41a15b2bba72ed3307f4cbc5899a Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 11 Jul 2025 03:15:54 +0000 Subject: [PATCH 2/5] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- network/netmanager/include/net_connection_type.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index 469153447..c4c39cf8e 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -131,6 +131,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. * -- Gitee From c08936122a02b9f223d83e791bdd90ba5a800196 Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 11 Jul 2025 03:16:27 +0000 Subject: [PATCH 3/5] update network/netmanager/include/net_connection_type.h. Signed-off-by: jxw --- .../netmanager/include/net_connection_type.h | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index c4c39cf8e..2fa551190 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -405,6 +405,32 @@ 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; + /** Packets type */ + 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 ef45016d81e93e0fc4a8237a07a9e5c048196709 Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 11 Jul 2025 03:17:17 +0000 Subject: [PATCH 4/5] update network/netmanager/libnet_connection.ndk.json. Signed-off-by: jxw --- network/netmanager/libnet_connection.ndk.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index 7d32accef..ed2a16131 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -90,5 +90,9 @@ { "first_introduced": "20", "name": "OH_NetConn_QueryProbeResult" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_QueryTraceRoute" } ] \ No newline at end of file -- Gitee From 23551b56c08c3043d0e626e5dcb359a0de3f9dcf Mon Sep 17 00:00:00 2001 From: jxw Date: Sat, 12 Jul 2025 07:17:08 +0000 Subject: [PATCH 5/5] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index aaf11f6e8..0ab63a063 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -395,8 +395,6 @@ int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn * @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 */ -- Gitee