diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-30 20:46:29 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-30 20:46:29 +0000 |
commit | 563ced5a52a1260c2165435a103c204c39a658f0 (patch) | |
tree | 1690f3ad402aa77528c4cefe28e399d87ed06fb6 /nuttx/examples/uip | |
parent | 31e64b14e31c58b25a8ebe6eb2672ac4d1847c1b (diff) | |
download | px4-nuttx-563ced5a52a1260c2165435a103c204c39a658f0.tar.gz px4-nuttx-563ced5a52a1260c2165435a103c204c39a658f0.tar.bz2 px4-nuttx-563ced5a52a1260c2165435a103c204c39a658f0.zip |
Add examples/dhcpd
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@413 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/uip')
-rw-r--r-- | nuttx/examples/uip/main.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/nuttx/examples/uip/main.c b/nuttx/examples/uip/main.c index 83da6fe2c..a5640f848 100644 --- a/nuttx/examples/uip/main.c +++ b/nuttx/examples/uip/main.c @@ -51,6 +51,7 @@ #include <time.h> #include <debug.h> +#include <net/if.h> #include <net/uip/uip.h> #include <net/uip/uip-arp.h> #include <net/uip/uip-lib.h> @@ -85,6 +86,12 @@ * Definitions ****************************************************************************/ +#ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +#else +# define message(...) printf(__VA_ARGS__) +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -120,9 +127,7 @@ void user_initialize(void) int user_start(int argc, char *argv[]) { -#if !defined(CONFIG_EXAMPLE_UIP_DHCPC) struct in_addr addr; -#endif #if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC) uint8 mac[IFHWADDRLEN]; #endif @@ -142,10 +147,13 @@ int user_start(int argc, char *argv[]) uip_setmacaddr("eth0", mac); #endif -#if !defined(CONFIG_EXAMPLE_UIP_DHCPC) /* Set up our host address */ +#if !defined(CONFIG_EXAMPLE_UIP_DHCPC) addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_IPADDR); +#else + addr.s_addr = 0; +#endif uip_sethostaddr("eth0", &addr); /* Set up the default router address */ @@ -157,7 +165,6 @@ int user_start(int argc, char *argv[]) addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_NETMASK); uip_setnetmask("eth0", &addr); -#endif #if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_WEBCLIENT) /* Set up the resolver */ |