From 5b749432f1d6ee44c79d0a1875f35ccf59fe668f Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 15 Aug 2025 08:24:01 +0000 Subject: [PATCH 1/4] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 67 +++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 0ab63a06308..70cdeb84a86 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -401,6 +401,73 @@ int32_t OH_NetConn_QueryProbeResult(char *destination, int32_t duration, NetConn int32_t OH_NetConn_QueryTraceRoute(char *destination, NetConn_TraceRouteOption *option, NetConn_TraceRouteInfo *traceRouteInfo); +/** + * @brief Sets the URL of the current PAC file script. + * Proxy information can be obtained through parsing the script address. + * + * @param pacUrl the URL of the current PAC script. + * @return the result defines in {@link NetConn_ErrorCode}. + * {@link NETCONN_SUCCESS} Success. + * {@link NETCONN_PERMISSION_DENIED} Permission denied. + * {@link NETCONN_PARAMETER_ERROR} Parameter check failed. + * {@link NETCONN_OPERATION_FAILED} Failed to connect to the service. + * @permission ohos.permission.SET_PAC_URL + * @since 20 + */ +NetConn_ErrorCode OH_NetConn_SetPacFileUrl(const char *pacUrl); + +/** + * @brief find the proxy infomation for the url + * @param url the url link + * @param proxy the pac proxy infomation + * @return the proxy result + * @since 20 + */ +NetConn_ErrorCode OH_NetConn_FindProxyForUrl(const char *url, char *proxy); + +/** + * @brief Obtains the URL of the current PAC file script. + * + * @param pacUrl the URL of the current PAC script. + * @return the result defines in {@link NetConn_ErrorCode}. + * {@link NETCONN_SUCCESS} Success. + * {@link NETCONN_PARAMETER_ERROR} Parameter check failed. + * {@link NETCONN_OPERATION_FAILED} Failed to connect to the service. + * @since 20 + */ +NetConn_ErrorCode OH_NetConn_GetPacFileUrl(char *pacUrl); + +/** + * @brief Registers a callback to listen the pac file url changed. + * + * @param pacFileUrlChange The callback needed to be registered. + * @param callbackId out param, corresponding to a registered callback. + * @return 0 - Success. + * 201 - Permission denied. + * 401 - Parameter error. + * 2100002 - Failed to connect to the service. + * 2100003 - System internal error. + * 2101008 - The callback already exists. + * 2101022 - The number of requests exceeded the maximum allowed. + * @since 20 + */ +int32_t OH_NetConn_RegisterPacFileUrlCallback(OH_NetConn_PacFileUrlChange *pacFileUrlChange, uint32_t *callbackId); + +/** + * @brief Unregisters pac file url change callback. + * + * @param callBackId the id corresponding to a registered callback. + * @return 0 - Success. + * 201 - Permission denied. + * 401 - Parameter error. + * 2100002 - Failed to connect to the service. + * 2100003 - System internal error. + * 2101007 - The callback does not exists. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 20 + */ +int32_t OH_NetConn_UnregisterPacFileUrlCallback(uint32_t callBackId); + #ifdef __cplusplus } #endif -- Gitee From bfc5319b580a9f959f276bf49868188a4493a35f Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 15 Aug 2025 08:25:12 +0000 Subject: [PATCH 2/4] update network/netmanager/libnet_connection.ndk.json. Signed-off-by: jxw --- network/netmanager/libnet_connection.ndk.json | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index ed2a1613159..c9cbc2b412d 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -94,5 +94,25 @@ { "first_introduced": "20", "name": "OH_NetConn_QueryTraceRoute" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_SetPacFileUrl" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_GetPacFileUrl" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_FindProxyForUrl" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_RegisterPacFileUrlCallback" + }, + { + "first_introduced": "20", + "name": "OH_NetConn_UnregisterPacFileUrlCallback" } ] \ No newline at end of file -- Gitee From fa2bb7c34ce6266eb9b339b5a6d2b421477766a4 Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 15 Aug 2025 10:39:04 +0000 Subject: [PATCH 3/4] update network/netmanager/include/net_connection.h. Signed-off-by: jxw --- network/netmanager/include/net_connection.h | 31 --------------------- 1 file changed, 31 deletions(-) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 70cdeb84a86..a8a896b8b8b 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -437,37 +437,6 @@ NetConn_ErrorCode OH_NetConn_FindProxyForUrl(const char *url, char *proxy); */ NetConn_ErrorCode OH_NetConn_GetPacFileUrl(char *pacUrl); -/** - * @brief Registers a callback to listen the pac file url changed. - * - * @param pacFileUrlChange The callback needed to be registered. - * @param callbackId out param, corresponding to a registered callback. - * @return 0 - Success. - * 201 - Permission denied. - * 401 - Parameter error. - * 2100002 - Failed to connect to the service. - * 2100003 - System internal error. - * 2101008 - The callback already exists. - * 2101022 - The number of requests exceeded the maximum allowed. - * @since 20 - */ -int32_t OH_NetConn_RegisterPacFileUrlCallback(OH_NetConn_PacFileUrlChange *pacFileUrlChange, uint32_t *callbackId); - -/** - * @brief Unregisters pac file url change callback. - * - * @param callBackId the id corresponding to a registered callback. - * @return 0 - Success. - * 201 - Permission denied. - * 401 - Parameter error. - * 2100002 - Failed to connect to the service. - * 2100003 - System internal error. - * 2101007 - The callback does not exists. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 20 - */ -int32_t OH_NetConn_UnregisterPacFileUrlCallback(uint32_t callBackId); - #ifdef __cplusplus } #endif -- Gitee From 97cc77179369a99cbde85451ab8f0041740bf29e Mon Sep 17 00:00:00 2001 From: jxw Date: Fri, 15 Aug 2025 10:39:38 +0000 Subject: [PATCH 4/4] update network/netmanager/libnet_connection.ndk.json. Signed-off-by: jxw --- network/netmanager/libnet_connection.ndk.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index c9cbc2b412d..b5be47e8e8a 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -106,13 +106,5 @@ { "first_introduced": "20", "name": "OH_NetConn_FindProxyForUrl" - }, - { - "first_introduced": "20", - "name": "OH_NetConn_RegisterPacFileUrlCallback" - }, - { - "first_introduced": "20", - "name": "OH_NetConn_UnregisterPacFileUrlCallback" } ] \ No newline at end of file -- Gitee