From 1f4154b1fd5db046b4cdabde1c04a93093bab133 Mon Sep 17 00:00:00 2001 From: liuxiyao Date: Wed, 8 Nov 2023 18:25:13 +0800 Subject: [PATCH] add dns capi Signed-off-by: liuxiyao --- .../native_sdk/net/dns/native_net_conn_api.h | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 14095ef6..4b689974 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -79,6 +79,37 @@ int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, st */ int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); +/** + * @brief 注册自定义DNS解析器 + * + * @param resolve 自定义DNS解析函数的函数指针 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 +*/ +int32_t OHOS_NetConn_RegisterDnsHook(customdnsresolve resolve); + +/** + * @brief 解注册自定义DNS解析器 + * + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 +*/ +int32_t OHOS_NetConn_UnRegisterDnsHook(void); + #ifdef __cplusplus } #endif -- Gitee