ReactOS 0.4.16-dev-297-gc569aee
dns.h
Go to the documentation of this file.
1
39#ifndef LWIP_HDR_DNS_H
40#define LWIP_HDR_DNS_H
41
42#include "lwip/opt.h"
43
44#if LWIP_DNS
45
46#include "lwip/ip_addr.h"
47#include "lwip/err.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
54#define DNS_TMR_INTERVAL 1000
55
56/* DNS resolve types: */
57#define LWIP_DNS_ADDRTYPE_IPV4 0
58#define LWIP_DNS_ADDRTYPE_IPV6 1
59#define LWIP_DNS_ADDRTYPE_IPV4_IPV6 2 /* try to resolve IPv4 first, try IPv6 if IPv4 fails only */
60#define LWIP_DNS_ADDRTYPE_IPV6_IPV4 3 /* try to resolve IPv6 first, try IPv4 if IPv6 fails only */
61#if LWIP_IPV4 && LWIP_IPV6
62#ifndef LWIP_DNS_ADDRTYPE_DEFAULT
63#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4_IPV6
64#endif
65#elif LWIP_IPV4
66#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4
67#else
68#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV6
69#endif
70
71#if DNS_LOCAL_HOSTLIST
73struct local_hostlist_entry {
75 const char *name;
78 struct local_hostlist_entry *next;
79};
80#define DNS_LOCAL_HOSTLIST_ELEM(name, addr_init) {name, addr_init, NULL}
81#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
82#ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN
83#define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH
84#endif
85#define LOCALHOSTLIST_ELEM_SIZE ((sizeof(struct local_hostlist_entry) + DNS_LOCAL_HOSTLIST_MAX_NAMELEN + 1))
86#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
87#endif /* DNS_LOCAL_HOSTLIST */
88
89#if LWIP_IPV4
90extern const ip_addr_t dns_mquery_v4group;
91#endif /* LWIP_IPV4 */
92#if LWIP_IPV6
93extern const ip_addr_t dns_mquery_v6group;
94#endif /* LWIP_IPV6 */
95
103typedef void (*dns_found_callback)(const char *name, const ip_addr_t *ipaddr, void *callback_arg);
104
105void dns_init(void);
106void dns_tmr(void);
107void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver);
108const ip_addr_t* dns_getserver(u8_t numdns);
109err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
110 dns_found_callback found, void *callback_arg);
111err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr,
112 dns_found_callback found, void *callback_arg,
113 u8_t dns_addrtype);
114
115
116#if DNS_LOCAL_HOSTLIST
117size_t dns_local_iterate(dns_found_callback iterator_fn, void *iterator_arg);
118err_t dns_local_lookup(const char *hostname, ip_addr_t *addr, u8_t dns_addrtype);
119#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
120int dns_local_removehost(const char *hostname, const ip_addr_t *addr);
121err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
122#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
123#endif /* DNS_LOCAL_HOSTLIST */
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* LWIP_DNS */
130
131#endif /* LWIP_HDR_DNS_H */
char * hostname
Definition: ftp.c:88
GLenum const GLvoid * addr
Definition: glext.h:9621
uint8_t u8_t
Definition: arch.h:125
s8_t err_t
Definition: err.h:96
ip6_addr_t ip_addr_t
Definition: ip_addr.h:344
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: name.c:39