diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 0ab63a063080a619c9d6d44964064b819a5e8a44..7716f87e3e647a26ef44a5028ed8184f7254240d 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -401,6 +401,75 @@ 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. + * + * @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. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 20 + * @version 1.0 + */ +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 + * @syscap SystemCapability.Communication.NetManager.Core + * @since 20 + * @version 1.0 + */ +int32_t OH_NetConn_UnregisterPacFileUrlCallback(uint32_t callBackId); #ifdef __cplusplus } #endif diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index ed2a16131598098e136c2718e19eecb1c6c753e1..493aebabe05d789a7d99e0b0a3c87ccf525a8f8b 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -94,5 +94,17 @@ { "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" } ] \ No newline at end of file