From e0a9ced0593b3a689b72818f4f507a254d5f97e2 Mon Sep 17 00:00:00 2001 From: zhouxj Date: Wed, 30 Oct 2024 15:09:12 +0800 Subject: [PATCH] =?UTF-8?q?NDK=20OHOS=E6=8E=A5=E5=8F=A3=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouxj Change-Id: Ic1d3458c65ae94bebdc06d99f8b81ef3161d4320 --- network/netmanager/include/net_connection.h | 34 ++++++++++++++++++- network/netmanager/libnet_connection.ndk.json | 8 +++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 76d12d406..6c5c4c2f2 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -186,6 +186,8 @@ int32_t OH_NetConn_GetAllNets(NetConn_NetHandleList *netHandleList); * 2100003 - Internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core + * @deprecated since 13 + * @useinstead OH_NetConn_RegisterDnsResolver * @since 11 * @version 1.0 */ @@ -199,11 +201,41 @@ int32_t OHOS_NetConn_RegisterDnsResolver(OH_NetConn_CustomDnsResolver resolver); * 2100003 - Internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core + * @deprecated since 13 + * @useinstead OH_NetConn_UnregisterDnsResolver * @since 11 * @version 1.0 */ int32_t OHOS_NetConn_UnregisterDnsResolver(void); +/** + * @brief Registers a custom DNS resolver. + * + * @param resolver Pointer to the custom DNS resolver. + * @return Returns the result code. + * {@link NETMANAGER_EXT_SUCCESS} if the operation is successful. + * {@link NETMANAGER_ERR_PERMISSION_DENIED} Missing permissions, add permission. + * {@link NETMANAGER_ERR_PARAMETER_ERROR} Parameter error. Please enter a correct parameter. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 13 + * @version 1.0 + */ +int32_t OH_NetConn_RegisterDnsResolver(OH_NetConn_CustomDnsResolver resolver); + +/** + * @brief Unregisters a custom DNS resolver. + * + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 13 + * @version 1.0 + */ +int32_t OH_NetConn_UnregisterDnsResolver(void); + /** * @brief Binds a socket to the specific network. * diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index 792eff18e..41b98af11 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -70,5 +70,13 @@ { "first_introduced": "12", "name": "OH_NetConn_UnregisterNetConnCallback" + }, + { + "first_introduced": "13", + "name": "OH_NetConn_RegisterDnsResolver" + }, + { + "first_introduced": "13", + "name": "OH_NetConn_UnregisterDnsResolver" } ] \ No newline at end of file