mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-04 21:39:49 +00:00
Changed dns_gethostbyname_addrtype() to always be a function, fixed code for C PP :-(
This commit is contained in:
parent
42170e4e57
commit
77270adb96
@ -1840,12 +1840,15 @@ void
|
||||
lwip_netconn_do_gethostbyname(void *arg)
|
||||
{
|
||||
struct dns_api_msg *msg = (struct dns_api_msg*)arg;
|
||||
|
||||
API_EXPR_DEREF(msg->err) = dns_gethostbyname_addrtype(msg->name, API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg
|
||||
u8_t addrtype =
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
, msg->dns_addrtype
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
);
|
||||
msg->dns_addrtype;
|
||||
#else
|
||||
LWIP_DNS_ADDRTYPE_DEFAULT;
|
||||
#endif
|
||||
|
||||
API_EXPR_DEREF(msg->err) = dns_gethostbyname_addrtype(msg->name,
|
||||
API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg, addrtype);
|
||||
if (API_EXPR_DEREF(msg->err) != ERR_INPROGRESS) {
|
||||
/* on error or immediate success, wake up the application
|
||||
* task waiting in netconn_gethostbyname */
|
||||
|
@ -1422,8 +1422,7 @@ err_t
|
||||
dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found,
|
||||
void *callback_arg)
|
||||
{
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
return dns_gethostbyname_addrtype(hostname, addr, found, callback_arg, LWIP_DNS_ADDRTYPE_IPV4_IPV6);
|
||||
return dns_gethostbyname_addrtype(hostname, addr, found, callback_arg, LWIP_DNS_ADDRTYPE_DEFAULT);
|
||||
}
|
||||
|
||||
/** Like dns_gethostbyname, but returned address type can be controlled:
|
||||
@ -1436,7 +1435,6 @@ err_t
|
||||
dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found,
|
||||
void *callback_arg, u8_t dns_addrtype)
|
||||
{
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
size_t hostnamelen;
|
||||
/* not initialized or no valid server yet, or invalid addr pointer
|
||||
* or invalid hostname or invalid hostname length */
|
||||
|
@ -50,6 +50,15 @@ extern "C" {
|
||||
#define LWIP_DNS_ADDRTYPE_IPV6 1
|
||||
#define LWIP_DNS_ADDRTYPE_IPV4_IPV6 2 /* try to resolve IPv4 first, try IPv6 if IPv4 fails only */
|
||||
#define LWIP_DNS_ADDRTYPE_IPV6_IPV4 3 /* try to resolve IPv6 first, try IPv4 if IPv6 fails only */
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
#ifndef LWIP_DNS_ADDRTYPE_DEFAULT
|
||||
#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4_IPV6
|
||||
#endif
|
||||
#elif defined(LWIP_IPV4)
|
||||
#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4
|
||||
#else
|
||||
#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV6
|
||||
#endif
|
||||
|
||||
#if DNS_LOCAL_HOSTLIST
|
||||
/** struct used for local host-list */
|
||||
@ -83,14 +92,9 @@ void dns_setserver(u8_t numdns, ip_addr_t *dnsserver);
|
||||
ip_addr_t dns_getserver(u8_t numdns);
|
||||
err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
|
||||
dns_found_callback found, void *callback_arg);
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr,
|
||||
dns_found_callback found, void *callback_arg,
|
||||
u8_t dns_addrtype);
|
||||
#else /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
#define dns_gethostbyname_addrtype(hostname, addr, found, callback_arg, dns_addrtype) \
|
||||
dns_gethostbyname(hostname, addr, found, callback_arg)
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
|
||||
|
||||
#if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
|
||||
|
Loading…
x
Reference in New Issue
Block a user