Minor change for DNS client in msvc6 port.

This commit is contained in:
fbernon 2007-11-14 23:37:22 +00:00
parent 8105013eb0
commit 191d815ab1
4 changed files with 43 additions and 12 deletions

View File

@ -38,8 +38,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
/** @todo fix SNMP warnings */ /** @todo fix some warnings */
#pragma warning (disable: 4244) #pragma warning (disable: 4244)
#pragma warning (disable: 4996)
#define LWIP_PROVIDE_ERRNO #define LWIP_PROVIDE_ERRNO

View File

@ -178,6 +178,10 @@ SOURCE="$(LWIP_SRC)\core\dhcp.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="$(LWIP_SRC)\core\dns.c"
# End Source File
# Begin Source File
SOURCE="$(LWIP_SRC)\core\inet.c" SOURCE="$(LWIP_SRC)\core\inet.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -290,6 +294,10 @@ SOURCE="$(LWIP_SRC)\include\lwip\dhcp.h"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="$(LWIP_SRC)\include\lwip\dns.h"
# End Source File
# Begin Source File
SOURCE="$(LWIP_SRC)\include\lwip\err.h" SOURCE="$(LWIP_SRC)\include\lwip\err.h"
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -40,6 +40,8 @@
#define LWIP_ICMP 1 #define LWIP_ICMP 1
#define LWIP_SNMP 1 #define LWIP_SNMP 1
#define LWIP_DNS 1
#define LWIP_HAVE_LOOPIF 1 #define LWIP_HAVE_LOOPIF 1
#define LWIP_COMPAT_SOCKETS 1 #define LWIP_COMPAT_SOCKETS 1
@ -54,12 +56,6 @@
#ifdef LWIP_DEBUG #ifdef LWIP_DEBUG
#define LWIP_DBG_MIN_LEVEL 0 #define LWIP_DBG_MIN_LEVEL 0
#define TAPIF_DEBUG LWIP_DBG_OFF
#define TUNIF_DEBUG LWIP_DBG_OFF
#define UNIXIF_DEBUG LWIP_DBG_OFF
#define DELIF_DEBUG LWIP_DBG_OFF
#define SIO_FIFO_DEBUG LWIP_DBG_OFF
#define TCPDUMP_DEBUG LWIP_DBG_OFF
#define PPP_DEBUG LWIP_DBG_OFF #define PPP_DEBUG LWIP_DBG_OFF
#define MEM_DEBUG LWIP_DBG_OFF #define MEM_DEBUG LWIP_DBG_OFF
#define MEMP_DEBUG LWIP_DBG_OFF #define MEMP_DEBUG LWIP_DBG_OFF
@ -69,10 +65,11 @@
#define TCPIP_DEBUG LWIP_DBG_OFF #define TCPIP_DEBUG LWIP_DBG_OFF
#define NETIF_DEBUG LWIP_DBG_OFF #define NETIF_DEBUG LWIP_DBG_OFF
#define SOCKETS_DEBUG LWIP_DBG_OFF #define SOCKETS_DEBUG LWIP_DBG_OFF
#define DEMO_DEBUG LWIP_DBG_OFF #define DNS_DEBUG LWIP_DBG_OFF
#define IP_DEBUG LWIP_DBG_OFF #define IP_DEBUG LWIP_DBG_OFF
#define IP_REASS_DEBUG LWIP_DBG_OFF #define IP_REASS_DEBUG LWIP_DBG_OFF
#define ICMP_DEBUG LWIP_DBG_OFF #define ICMP_DEBUG LWIP_DBG_OFF
#define IGMP_DEBUG LWIP_DBG_OFF
#define UDP_DEBUG LWIP_DBG_OFF #define UDP_DEBUG LWIP_DBG_OFF
#define TCP_DEBUG LWIP_DBG_OFF #define TCP_DEBUG LWIP_DBG_OFF
#define TCP_INPUT_DEBUG LWIP_DBG_OFF #define TCP_INPUT_DEBUG LWIP_DBG_OFF
@ -87,6 +84,7 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */ /* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
@ -117,7 +115,7 @@ a lot of data that needs to be copied, this should be set high. */
#define MEMP_NUM_TCP_SEG 16 #define MEMP_NUM_TCP_SEG 16
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
timeouts. */ timeouts. */
#define MEMP_NUM_SYS_TIMEOUT 8 #define MEMP_NUM_SYS_TIMEOUT 10
/* The following four are used only with the sequential API and can be /* The following four are used only with the sequential API and can be
set to 0 if the application only will use the raw API. */ set to 0 if the application only will use the raw API. */
@ -150,6 +148,7 @@ a lot of data that needs to be copied, this should be set high. */
*/ */
#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0) #define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
/* ---------- TCP options ---------- */ /* ---------- TCP options ---------- */
#define LWIP_TCP 1 #define LWIP_TCP 1
#define TCP_TTL 255 #define TCP_TTL 255
@ -182,18 +181,19 @@ a lot of data that needs to be copied, this should be set high. */
/* Maximum number of retransmissions of SYN segments. */ /* Maximum number of retransmissions of SYN segments. */
#define TCP_SYNMAXRTX 4 #define TCP_SYNMAXRTX 4
/* ---------- ARP options ---------- */ /* ---------- ARP options ---------- */
#define LWIP_ARP 1 #define LWIP_ARP 1
#define ARP_TABLE_SIZE 10 #define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 1 #define ARP_QUEUEING 1
/* ---------- IP options ---------- */ /* ---------- IP options ---------- */
/* Define IP_FORWARD to 1 if you wish to have the ability to forward /* Define IP_FORWARD to 1 if you wish to have the ability to forward
IP packets across network interfaces. If you are going to run lwIP IP packets across network interfaces. If you are going to run lwIP
on a device with only one network interface, define this to 0. */ on a device with only one network interface, define this to 0. */
#define IP_FORWARD 1 #define IP_FORWARD 1
/* IP reassembly and segmentation.These are orthogonal even /* IP reassembly and segmentation.These are orthogonal even
* if they both deal with IP fragments */ * if they both deal with IP fragments */
#define IP_REASSEMBLY 1 #define IP_REASSEMBLY 1
@ -201,23 +201,28 @@ a lot of data that needs to be copied, this should be set high. */
#define MEMP_NUM_REASSDATA 10 #define MEMP_NUM_REASSDATA 10
#define IP_FRAG 1 #define IP_FRAG 1
/* ---------- ICMP options ---------- */ /* ---------- ICMP options ---------- */
#define ICMP_TTL 255 #define ICMP_TTL 255
/* ---------- DHCP options ---------- */ /* ---------- DHCP options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of /* Define LWIP_DHCP to 1 if you want DHCP configuration of
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
turning this on does currently not work. */ turning this on does currently not work. */
#define LWIP_DHCP 0 #define LWIP_DHCP 0
#define LWIP_AUTOIP 0
/* 1 if you want to do an ARP check on the offered address /* 1 if you want to do an ARP check on the offered address
(recommended). */ (recommended). */
#if LWIP_DHCP #if LWIP_DHCP
#define DHCP_DOES_ARP_CHECK 1 #define DHCP_DOES_ARP_CHECK 1
#endif #endif
/* ---------- AUTOIP options ------- */
#define LWIP_AUTOIP 0
/* ---------- UDP options ---------- */ /* ---------- UDP options ---------- */
#define LWIP_UDP 1 #define LWIP_UDP 1
#define LWIP_UDPLITE 1 #define LWIP_UDPLITE 1
@ -243,6 +248,7 @@ a lot of data that needs to be copied, this should be set high. */
#define SYS_STATS 1 #define SYS_STATS 1
#endif /* LWIP_STATS */ #endif /* LWIP_STATS */
/* ---------- PPP options ---------- */ /* ---------- PPP options ---------- */
#define PPP_SUPPORT 0 /* Set > 0 for PPP */ #define PPP_SUPPORT 0 /* Set > 0 for PPP */

View File

@ -48,6 +48,7 @@
#include "lwip/tcp.h" #include "lwip/tcp.h"
#include "lwip/udp.h" #include "lwip/udp.h"
#include "lwip/dns.h"
/* lwIP netif includes */ /* lwIP netif includes */
#include "netif/loopif.h" #include "netif/loopif.h"
@ -120,6 +121,9 @@ static timers_infos timers_table[] = {
#if LWIP_IGMP #if LWIP_IGMP
{ 0, IGMP_TMR_INTERVAL, igmp_tmr}, { 0, IGMP_TMR_INTERVAL, igmp_tmr},
#endif /* LWIP_IGMP */ #endif /* LWIP_IGMP */
#if LWIP_DNS
{ 0, DNS_TMR_INTERVAL, dns_tmr},
#endif /* LWIP_DNS */
}; };
/* initialize stack when NO_SYS=1 */ /* initialize stack when NO_SYS=1 */
@ -198,10 +202,22 @@ msvc_netif_init()
#endif /* LWIP_HAVE_LOOPIF */ #endif /* LWIP_HAVE_LOOPIF */
} }
void dns_found(char *name, struct ip_addr *addr, void *arg)
{ printf("%s: %s\n", name, addr?inet_ntoa(*(struct in_addr*)addr):"<not found>");
}
/* This function initializes applications */ /* This function initializes applications */
static void static void
apps_init() apps_init()
{ {
#if LWIP_DNS
char* dnsname="3com.com";
struct ip_addr dnsresp;
if (dns_gethostbyname(dnsname, &dnsresp, dns_found, 0) == DNS_COMPLETE) {
dns_found(dnsname, &dnsresp, 0);
}
#endif /* LWIP_DNS */
#if LWIP_RAW #if LWIP_RAW
ping_init(); ping_init();
#endif /* LWIP_RAW */ #endif /* LWIP_RAW */