From 2018dd43e077d54040c384e72de36e3bcd06ab78 Mon Sep 17 00:00:00 2001 From: jxw Date: Sun, 26 Jan 2025 12:04:48 +0000 Subject: [PATCH 1/2] update network/netmanager/include/net_connection.h. --- network/netmanager/include/net_connection.h | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 13294313d..1cd795d05 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -344,6 +344,33 @@ int32_t OH_NetConn_RegisterDefaultNetConnCallback(NetConn_NetConnCallback *netCo */ int32_t OH_NetConn_UnregisterNetConnCallback(uint32_t callBackId); +/** + * @brief Sets the URL of the current PAC 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. + * {@link NETCONN_INTERNAL_ERROR} System internal error. + * @permission ohos.permission.SET_PAC_URL + * @since 15 + */ +NetConn_ErrorCode OH_NetConn_SetPacUrl(const char *pacUrl); + +/** + * @brief Obtains the URL of the current PAC 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. + * {@link NETCONN_INTERNAL_ERROR} System internal error. + * @since 15 + */ +NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); #ifdef __cplusplus } #endif -- Gitee From 1c4447cc03997a91fe5874f57e222d23e5f28c95 Mon Sep 17 00:00:00 2001 From: jxw Date: Sun, 26 Jan 2025 12:05:42 +0000 Subject: [PATCH 2/2] update network/netmanager/include/net_connection_type.h. --- .../netmanager/include/net_connection_type.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index 663f39a7d..664656fd5 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -108,6 +108,28 @@ typedef enum NetConn_NetBearerType { NETCONN_BEARER_VPN = 4, } NetConn_NetBearerType; +/** + * @brief Enumerates NetConn error codes. + * + * @since 15 + */ +typedef enum NetConn_ErrorCode { + /** @error Success return code on success*/ + NETCONN_SUCCESS = 0, + /** @error Permission verification failed */ + NETCONN_PERMISSION_DENIED = 201, + /** @error Parameter check failed */ + NETCONN_PARAMETER_ERROR = 401, + /** @error Failed to connect to the service */ + NETCONN_OPERATION_FAILED = 2100002, + /** + * @error System internal error. + * 1. Memory-related error, for example, insufficient memory or memory data copy failures. + * 2. Null pointer error, for example, using memory that has already been released. + */ + NETCONN_INTERNAL_ERROR = 2100003 +} NetConn_ErrorCode; + /** * @brief Defines the network handle. * -- Gitee