STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
dns.h
Go to the documentation of this file.
1 
34 #ifndef LWIP_HDR_DNS_H
35 #define LWIP_HDR_DNS_H
36 
37 #include "lwip/opt.h"
38 
39 #if LWIP_DNS
40 
41 #include "lwip/ip_addr.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
48 #define DNS_TMR_INTERVAL 1000
49 
50 /* DNS resolve types: */
51 #define LWIP_DNS_ADDRTYPE_IPV4 0
52 #define LWIP_DNS_ADDRTYPE_IPV6 1
53 #define LWIP_DNS_ADDRTYPE_IPV4_IPV6 2 /* try to resolve IPv4 first, try IPv6 if IPv4 fails only */
54 #define LWIP_DNS_ADDRTYPE_IPV6_IPV4 3 /* try to resolve IPv6 first, try IPv4 if IPv6 fails only */
55 #if LWIP_IPV4 && LWIP_IPV6
56 #ifndef LWIP_DNS_ADDRTYPE_DEFAULT
57 #define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4_IPV6
58 #endif
59 #elif defined(LWIP_IPV4)
60 #define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4
61 #else
62 #define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV6
63 #endif
64 
65 #if DNS_LOCAL_HOSTLIST
66 
67 struct local_hostlist_entry {
69  const char *name;
71  ip_addr_t addr;
72  struct local_hostlist_entry *next;
73 };
74 #if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
75 #ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN
76 #define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH
77 #endif
78 #define LOCALHOSTLIST_ELEM_SIZE ((sizeof(struct local_hostlist_entry) + DNS_LOCAL_HOSTLIST_MAX_NAMELEN + 1))
79 #endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
80 #endif /* DNS_LOCAL_HOSTLIST */
81 
89 typedef void (*dns_found_callback)(const char *name, const ip_addr_t *ipaddr, void *callback_arg);
90 
91 void dns_init(void);
92 void dns_tmr(void);
93 void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver);
94 ip_addr_t dns_getserver(u8_t numdns);
95 err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
96  dns_found_callback found, void *callback_arg);
97 err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr,
98  dns_found_callback found, void *callback_arg,
99  u8_t dns_addrtype);
100 
101 
102 #if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
103 int dns_local_removehost(const char *hostname, const ip_addr_t *addr);
104 err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
105 #endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* LWIP_DNS */
112 
113 #endif /* LWIP_HDR_DNS_H */
114 
s8_t err_t
Definition: err.h:47
unsigned char u8_t
Definition: cc.h:38
ip6_addr_t ip_addr_t
Definition: ip_addr.h:194