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"
浏览源代码.
|
#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
|
|
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
- 版权所有
- Copyright (c) tuya.inc 2019
◆ unm_get_dns_cache_priority()
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()
set the dns priority
- 参数
-
[in] | dns_prio | the 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] | domain | the domian name |
[in] | ip | the 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] | domain | the 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] | sockfd | the socket fd |
[in] | hostname | the domian name |
[in] | port | the tcp port |
[in] | retry_cnt | retry count if tcp connect failed |
[in] | timeout | timeout 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] | domain | the domain name |
[out] | addr | the 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