2019-07-28 10:31:56 +08:00
|
|
|
|
#ifndef ACL_DNS_INCLUDE_H
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#define ACL_DNS_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../stdlib/acl_define.h"
|
|
|
|
|
#include "../stdlib/acl_htable.h"
|
|
|
|
|
#include "../stdlib/acl_cache2.h"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#ifdef ACL_UNIX
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#endif
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../event/acl_events.h"
|
|
|
|
|
#include "../aio/acl_aio.h"
|
2021-05-31 10:56:27 +08:00
|
|
|
|
#include "acl_rfc1035.h"
|
2018-09-12 17:43:46 +08:00
|
|
|
|
#include "acl_sane_inet.h"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include "acl_netdb.h"
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* DNS <20><>ѯʱ<D1AF>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>붨<EFBFBD><EBB6A8> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2021-05-26 15:52:48 +08:00
|
|
|
|
#define ACL_DNS_OK 0
|
|
|
|
|
#define ACL_DNS_OK_CACHE 1
|
|
|
|
|
#define ACL_DNS_ERR_FMT -1
|
|
|
|
|
#define ACL_DNS_ERR_SVR -2
|
2020-09-01 16:25:39 +08:00
|
|
|
|
#define ACL_DNS_ERR_NO_EXIST -3
|
|
|
|
|
#define ACL_DNS_ERR_NO_SUPPORT -4
|
2021-05-26 15:52:48 +08:00
|
|
|
|
#define ACL_DNS_ERR_DENY -5
|
|
|
|
|
#define ACL_DNS_ERR_YX -6
|
|
|
|
|
#define ACL_DNS_ERR_YXRR -7
|
|
|
|
|
#define ACL_DNS_ERR_NXRR -8
|
|
|
|
|
#define ACL_DNS_ERR_NO_AUTH -9
|
2020-09-01 16:25:39 +08:00
|
|
|
|
#define ACL_DNS_ERR_NOT_ZONE -10
|
2021-05-26 15:52:48 +08:00
|
|
|
|
#define ACL_DNS_ERR_UNPACK -15
|
|
|
|
|
#define ACL_DNS_ERR_TIMEOUT -16
|
|
|
|
|
#define ACL_DNS_ERR_EXIST -17
|
2020-09-01 16:25:39 +08:00
|
|
|
|
#define ACL_DNS_ERR_BUILD_REQ -18
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
typedef struct ACL_DNS_ADDR {
|
2019-07-28 10:31:56 +08:00
|
|
|
|
char ip[64]; /* DNS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ */
|
2020-09-01 16:25:39 +08:00
|
|
|
|
unsigned short port; /* DNS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD> */
|
|
|
|
|
ACL_SOCKADDR addr; /* DNS <20><>ַ */
|
2019-07-28 10:31:56 +08:00
|
|
|
|
int addr_len; /* addr <20><>С */
|
|
|
|
|
int mask_length; /* DNS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>볤<EFBFBD><EBB3A4>(> 0 && < 32) */
|
|
|
|
|
struct in_addr in; /* addr <20><><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD>ַ */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
} ACL_DNS_ADDR;
|
|
|
|
|
|
|
|
|
|
typedef struct ACL_DNS {
|
2019-07-28 10:31:56 +08:00
|
|
|
|
ACL_AIO *aio; /* <20>첽IO<49><4F><EFBFBD><EFBFBD> */
|
|
|
|
|
unsigned short qid; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID<49><44>ʶ<EFBFBD><CAB6> */
|
2020-09-01 16:25:39 +08:00
|
|
|
|
ACL_ASTREAM *astream; /* <20>첽<EFBFBD><ECB2BD> */
|
2019-07-28 10:31:56 +08:00
|
|
|
|
|
|
|
|
|
ACL_ARRAY *groups; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD> */
|
2020-09-01 16:25:39 +08:00
|
|
|
|
ACL_ARRAY *dns_list; /* DNS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>б<EFBFBD> */
|
2019-08-13 18:29:40 +08:00
|
|
|
|
unsigned dns_idx; /* <20><>ǰʹ<C7B0>õ<EFBFBD> dns_list <20><><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD> */
|
2019-07-28 10:31:56 +08:00
|
|
|
|
ACL_DNS_ADDR addr_from; /* <20><>Դ DNS <20><>ַ */
|
|
|
|
|
ACL_HTABLE *lookup_table; /* <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
ACL_CACHE2 *dns_cache; /* <20><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>DNS<4E><53>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD> */
|
|
|
|
|
int timeout; /* ÿ<>β<EFBFBD>ѯ<EFBFBD>ij<EFBFBD>ʱʱ<CAB1><CAB1>ֵ(<28><>) */
|
|
|
|
|
int retry_limit; /* <20><>ѯ<EFBFBD><D1AF>ʱʱ<CAB1><CAB1><EFBFBD>ԵĴ<D4B5><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
unsigned int flag; /* <20><>־λ */
|
2020-09-01 16:25:39 +08:00
|
|
|
|
#define ACL_DNS_FLAG_ALLOC (1 << 0) /* <20><><EFBFBD>첽<EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2019-07-28 10:31:56 +08:00
|
|
|
|
#define ACL_DNS_FLAG_CHECK_DNS_IP (1 << 1) /* <20><><EFBFBD><EFBFBD>DNS<4E><53>ַ<EFBFBD>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5> */
|
|
|
|
|
#define ACL_DNS_FLAG_CHECK_DNS_NET (1 << 2) /* <20><><EFBFBD><EFBFBD>DNS<4E><53><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5> */
|
|
|
|
|
|
|
|
|
|
/* <20>ú<EFBFBD><C3BA><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<E2B6AF><CCAC><EFBFBD>ؿ<EFBFBD><D8BF>ķ<EFBFBD><C4B7>ʵ<EFBFBD>ַ<EFBFBD><D6B7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
ACL_EVENT_NOTIFY_TIME lookup_timeout;
|
|
|
|
|
} ACL_DNS;
|
|
|
|
|
|
|
|
|
|
typedef struct ACL_DNS_REQ ACL_DNS_REQ;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param aio {ACL_AIO*} <EFBFBD>첽<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} ÿ<EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ѯʱ<EFBFBD>ij<EFBFBD>ʱֵ
|
2019-12-16 10:43:50 +08:00
|
|
|
|
* @return {int} <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>-1 <EFBFBD><EFBFBD>ʾʧ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
2019-12-16 10:43:50 +08:00
|
|
|
|
ACL_API int acl_dns_init(ACL_DNS *dns, ACL_AIO *aio, int timeout);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param aio {ACL_AIO*} <EFBFBD>첽<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} ÿ<EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ѯʱ<EFBFBD>ij<EFBFBD>ʱֵ
|
2019-12-16 10:43:50 +08:00
|
|
|
|
* @return {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> DNS <EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_DNS *acl_dns_create(ACL_AIO *aio, int timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param limit {int} DNS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_open_cache(ACL_DNS *dns, int limit);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns_ip {const char*} DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param dns_port {unsigned short} DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|
|
|
|
* @param mask_length {int} DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>볤<EFBFBD><EFBFBD>(0 < && < 32)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_add_dns(ACL_DNS *dns, const char *dns_ip,
|
|
|
|
|
unsigned short dns_port, int mask_length);
|
2019-08-13 21:55:34 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DNS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>б<EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_clear_dns(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DNS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ACL_ARRAY*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_DNS_ADDR <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD> NULL
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_ARRAY *acl_dns_list(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DNS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {size_t}
|
|
|
|
|
*/
|
|
|
|
|
ACL_API size_t acl_dns_size(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ж<EFBFBD> DNS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>б<EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @retrn {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾΪ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_dns_empty(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ɾ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-09-13 19:47:23 +08:00
|
|
|
|
* @param ip {const char*} DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param port {unsigned short} DNS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
2019-08-13 21:55:34 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_del_dns(ACL_DNS *dns, const char *ip, unsigned short port);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>ر<EFBFBD><EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_close(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>־λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ԴIP<EFBFBD><EFBFBD>ַ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ϊ<EFBFBD>˷<EFBFBD>ֹDNS<EFBFBD><EFBFBD>ѯʱ<EFBFBD><EFBFBD>UDP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_check_dns_ip(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>־λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ԴIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ϊ<EFBFBD>˷<EFBFBD>ֹDNS<EFBFBD><EFBFBD>ѯʱ<EFBFBD><EFBFBD>UDP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_check_dns_net(ACL_DNS *dns);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param retry_limit {int} <EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_set_retry_limit(ACL_DNS *dns, int retry_limit);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>첽<EFBFBD><EFBFBD>ѯһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD>¼IP<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param domain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2021-05-31 10:56:27 +08:00
|
|
|
|
* @param callback {void (*)(ACL_DNS_DB*, void*, int, const ACL_RFC1035_MESSAGE*)}
|
|
|
|
|
* <EFBFBD><EFBFBD>ѯ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܵĻص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD> callback <EFBFBD><EFBFBD> ACL_DNS_DB Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ѯʧ<EFBFBD><EFBFBD>,
|
|
|
|
|
* <EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>õIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ѯʧ<EFBFBD><EFBFBD>ʱ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @param ctx {void*} callback <EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>֮һ
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
2020-07-01 15:57:57 +08:00
|
|
|
|
ACL_API void acl_dns_lookup(ACL_DNS *dns, const char *domain,
|
2021-05-31 10:56:27 +08:00
|
|
|
|
void (*callback)(ACL_DNS_DB*, void*, int, const ACL_RFC1035_MESSAGE*),
|
|
|
|
|
void *ctx);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2021-05-20 15:21:09 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>첽<EFBFBD><EFBFBD>ѯһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļ<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>IP<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param domain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param type {unsigned short} <EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD>μ<EFBFBD> acl_rfc1035.h <EFBFBD>е<EFBFBD> ACL_RFC1035_TYPE_XXX
|
2021-05-31 10:56:27 +08:00
|
|
|
|
* @param callback {void (*)(ACL_DNS_DB*, void*, int, const ACL_RFC1035_MESSAGE*)}
|
|
|
|
|
* <EFBFBD><EFBFBD>ѯ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܵĻص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD> callback <EFBFBD><EFBFBD> ACL_DNS_DB Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ѯʧ<EFBFBD><EFBFBD>,
|
|
|
|
|
* <EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>õIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ѯʧ<EFBFBD><EFBFBD>ʱ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2021-05-20 15:21:09 +08:00
|
|
|
|
* @param ctx {void*} callback <EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>֮һ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_lookup2(ACL_DNS *dns, const char *domain, unsigned short type,
|
2021-05-31 10:56:27 +08:00
|
|
|
|
void (*callback)(ACL_DNS_DB*, void*, int, const ACL_RFC1035_MESSAGE*),
|
|
|
|
|
void *ctx);
|
2021-05-20 15:21:09 +08:00
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param domain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param ip_list {const char*} IP<EFBFBD><EFBFBD>ַ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>Ϊ ';'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 192.168.0.1;192.168.0.2
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_add_host(ACL_DNS *dns, const char *domain, const char *ip_list);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @param dns {ACL_DNS*} DNS<EFBFBD>첽<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param group {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: .test.com, <EFBFBD><EFBFBD> a.test.com, b.test.com
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .test.com <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param ip_list {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD>̬<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ<EFBFBD>б<EFBFBD>
|
|
|
|
|
* @param refer {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD>DNS<EFBFBD><EFBFBD>ѯ
|
|
|
|
|
* @param excepts {ACL_ARGV*} <EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD>Щ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> group <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_add_group(ACL_DNS *dns, const char *group, const char *refer,
|
|
|
|
|
const char *ip_list, const char *excepts);
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* ȡ<EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param handle {ACL_DNS_REQ*} ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>¼<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_dns_cancel(ACL_DNS_REQ *handle);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵõ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @param errnum {int} DNS<EFBFBD><EFBFBD>ѯʱ<EFBFBD><EFBFBD><EFBFBD>صĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API const char *acl_dns_serror(int errnum);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|