TuyaOS
结构体 | 宏定义 | 类型定义 | 函数
uni_network.h 文件参考

Tuya iotdns module is the DNS service module provided by Tuya, which ensures that developers can provide reliable, safe and stable DNS services when accessing the network. Tuya iotdns provides a DNS mechanism of mutual protection for static zone DNS resolution, dynamic random zone DNS resolution and local system DNS resolution. Among them, the DNS resolution mechanism relies on Tuya The trusted DNS service provided in the cloud can obtain the optimal DNS policy according to the zone and provide a load balancing mechanism; the dynamic random zone DNS resolution is based on the zone DNS resolution mechanism. In order to avoid a protection mechanism provided by DNS failure 2, a random zone is selected in all non current zones for DNS request; the local system DNS is provided by the local operator As a backing mechanism, the basic DNS service of. Tuya iotdns can switch the resolution mechanism in case of failure to ensure the stability and security of the whole mechanism. 更多...

#include "tuya_iot_config.h"
#include "tuya_cloud_types.h"
#include "tal_network.h"
uni_network.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  TY_DNS_INFO_S
 DNS entry info 更多...
 

宏定义

#define DNS_PRIO_HTTP   0
 
#define DNS_PRIO_SYSTEM   1
 
#define MAX_DOMAIN_NAME_LEN   128
 max length of domain name
 

类型定义

typedef UINT_T TY_DNS_PRIO_T
 DNS priority
 

函数

TY_DNS_PRIO_T unm_get_dns_cache_priority (VOID)
 get the dns current priority 更多...
 
VOID unm_lower_dns_cache_priority (VOID)
 decrease the dns current priority 更多...
 
OPERATE_RET unm_set_dns_cache_priority (TY_DNS_PRIO_T dns_prio)
 set the dns priority 更多...
 
OPERATE_RET unw_add_dns_cache (CONST CHAR_T *domain, CONST TUYA_IP_ADDR_T ip)
 add dns information to dynamic dns cache 更多...
 
OPERATE_RET unw_clear_all_dns_cache (VOID)
 clean all dynamic dns cache 更多...
 
OPERATE_RET unw_clear_dns_cache (CONST CHAR_T *domain)
 clear the specific domain dns cache 更多...
 
OPERATE_RET unw_connect_to_domain (INT_T *sockfd, CHAR_T *hostname, UINT16_T port, UINT_T retry_cnt, UINT_T timeout)
 connect to a domain with specific tcp port 更多...
 
OPERATE_RET unw_gethostbyname (CONST CHAR_T *domain, IN CONST DNS_MODE_E mode, TUYA_IP_ADDR_T *ip)
 get the domain ip address info by the domain name 更多...
 
OPERATE_RET unw_init_dns_cache (VOID)
 init the dns module 更多...
 

详细描述

Tuya iotdns module is the DNS service module provided by Tuya, which ensures that developers can provide reliable, safe and stable DNS services when accessing the network. Tuya iotdns provides a DNS mechanism of mutual protection for static zone DNS resolution, dynamic random zone DNS resolution and local system DNS resolution. Among them, the DNS resolution mechanism relies on Tuya The trusted DNS service provided in the cloud can obtain the optimal DNS policy according to the zone and provide a load balancing mechanism; the dynamic random zone DNS resolution is based on the zone DNS resolution mechanism. In order to avoid a protection mechanism provided by DNS failure 2, a random zone is selected in all non current zones for DNS request; the local system DNS is provided by the local operator As a backing mechanism, the basic DNS service of. Tuya iotdns can switch the resolution mechanism in case of failure to ensure the stability and security of the whole mechanism.

版本
1.0
日期
2019-09-09

函数说明

◆ unm_get_dns_cache_priority()

TY_DNS_PRIO_T unm_get_dns_cache_priority ( VOID  )

get the dns current priority

返回
REGION_E the current priority

◆ unm_lower_dns_cache_priority()

VOID unm_lower_dns_cache_priority ( VOID  )

decrease the dns current priority

注解
if the priority is DNS_PRIO_SYSTEM, lower dns priority will return to DNS_PRIO_REGION

◆ unm_set_dns_cache_priority()

OPERATE_RET unm_set_dns_cache_priority ( TY_DNS_PRIO_T  dns_prio)

set the dns priority

参数
[in]dns_priothe new dns priority
返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h

◆ unw_add_dns_cache()

OPERATE_RET unw_add_dns_cache ( CONST CHAR_T *  domain,
CONST TUYA_IP_ADDR_T  ip 
)

add dns information to dynamic dns cache

参数
[in]domainthe domian name
[in]ipthe ip address of the domain name
返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h

◆ unw_clear_all_dns_cache()

OPERATE_RET unw_clear_all_dns_cache ( VOID  )

clean all dynamic dns cache

返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h

◆ unw_clear_dns_cache()

OPERATE_RET unw_clear_dns_cache ( CONST CHAR_T *  domain)

clear the specific domain dns cache

参数
[in]domainthe domian which need to clear
返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h

◆ unw_connect_to_domain()

OPERATE_RET unw_connect_to_domain ( INT_T *  sockfd,
CHAR_T *  hostname,
UINT16_T  port,
UINT_T  retry_cnt,
UINT_T  timeout 
)

connect to a domain with specific tcp port

参数
[out]sockfdthe socket fd
[in]hostnamethe domian name
[in]portthe tcp port
[in]retry_cntretry count if tcp connect failed
[in]timeouttimeout in ms
返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h

◆ unw_gethostbyname()

OPERATE_RET unw_gethostbyname ( CONST CHAR_T *  domain,
IN CONST DNS_MODE_E  mode,
TUYA_IP_ADDR_T *  ip 
)

get the domain ip address info by the domain name

参数
[in]domainthe domain name
[out]addrthe ip address of the domain
返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h

◆ unw_init_dns_cache()

OPERATE_RET unw_init_dns_cache ( VOID  )

init the dns module

返回
OPRT_OK: success, others: fail, please refer to tuya_error_code.h