summaryrefslogtreecommitdiff
path: root/nuttx/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-03-28 21:28:43 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-03-28 21:28:43 +0000
commit1b060ed713f398cafc8ddfd8d42b6c585812d6e1 (patch)
treea675633ad619c8a464c45dacb3305ff02ef169c9 /nuttx/examples
parent55849f9eccefbfa62dcdf5891e571c335de15736 (diff)
downloadpx4-nuttx-1b060ed713f398cafc8ddfd8d42b6c585812d6e1.tar.gz
px4-nuttx-1b060ed713f398cafc8ddfd8d42b6c585812d6e1.tar.bz2
px4-nuttx-1b060ed713f398cafc8ddfd8d42b6c585812d6e1.zip
Remove all options from examples/uip except for the webserver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1661 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples')
-rw-r--r--nuttx/examples/README.txt16
-rw-r--r--nuttx/examples/uip/main.c50
-rw-r--r--nuttx/examples/wget/host.c2
3 files changed, 19 insertions, 49 deletions
diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt
index ddf76e35d..52e0c542b 100644
--- a/nuttx/examples/README.txt
+++ b/nuttx/examples/README.txt
@@ -249,13 +249,17 @@ examples/udp
examples/uip
^^^^^^^^^^^^
- This is a port of uIP example application. It includes conditionally
- compiled logic to exercise the uIP webserver, telnet, smtp, dhcpc,
- and resolver.
+ This is a port of uIP tiny webserver example application. Settings
+ specific to this example include:
- Other configuratin items apply also to the selected network utility.
- For example, the additional relevant settings for the uIP webserver
- are:
+ CONFIG_EXAMPLE_UIP_NOMAC - (May be defined to use software assigned MAC)
+ CONFIG_EXAMPLE_UIP_IPADDR - Target IP address
+ CONFIG_EXAMPLE_UIP_DRIPADDR - Default router IP addess
+ CONFIG_EXAMPLE_UIP_NETMASK - Network mask
+ CONFIG_EXAMPLE_UIP_DHCPC - Select to get IP address via DHCP
+
+ Other configuration items apply also to the selected webserver net utility.
+ Additional relevant settings for the uIP webserver net utility are:
CONFIG_NETUTILS_HTTPDSTACKSIZE
CONFIG_NETUTILS_HTTPDFILESTATS
diff --git a/nuttx/examples/uip/main.c b/nuttx/examples/uip/main.c
index 2719f5bf7..79b4daa08 100644
--- a/nuttx/examples/uip/main.c
+++ b/nuttx/examples/uip/main.c
@@ -62,22 +62,14 @@
/* DHCPC may be used in conjunction with any other feature (or not) */
-#if defined(CONFIG_EXAMPLE_UIP_DHCPC)
+#ifdef CONFIG_EXAMPLE_UIP_DHCPC
# include <net/uip/resolv.h>
# include <net/uip/dhcpc.h>
#endif
-/* Pick the netutils feature under test (which may be DHCPC) */
+/* Include uIP webserver definitions */
-#if defined(CONFIG_EXAMPLE_UIP_SMTP)
-# include <net/uip/smtp.h>
-#elif defined(CONFIG_EXAMPLE_UIP_TELNETD)
-# include <net/uip/telnetd.h>
-#elif defined(CONFIG_EXAMPLE_UIP_WEBSERVER)
-# include <net/uip/httpd.h>
-#elif !defined(CONFIG_EXAMPLE_UIP_DHCPC)
-# error "No network application specified"
-#endif
+#include <net/uip/httpd.h>
/****************************************************************************
* Definitions
@@ -101,14 +93,6 @@
* Private Data
****************************************************************************/
-#if defined(CONFIG_EXAMPLE_UIP_SMTP)
-static const char g_host_name[] = "localhost";
-static const char g_recipient[] = "spudmonkey@racsa.co.cr";
-static const char g_sender[] = "nuttx-testing@example.com";
-static const char g_subject[] = "Testing SMTP from NuttX";
-static const char g_msg_body[] = "Test message sent by NuttX\r\n";
-#endif
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -136,7 +120,7 @@ int user_start(int argc, char *argv[])
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC)
uint8 mac[IFHWADDRLEN];
#endif
-#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_SMTP)
+#ifdef CONFIG_EXAMPLE_UIP_DHCPC
void *handle;
#endif
@@ -154,10 +138,10 @@ int user_start(int argc, char *argv[])
/* Set up our host address */
-#if !defined(CONFIG_EXAMPLE_UIP_DHCPC)
- addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_IPADDR);
-#else
+#ifdef CONFIG_EXAMPLE_UIP_DHCPC
addr.s_addr = 0;
+#else
+ addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_IPADDR);
#endif
uip_sethostaddr("eth0", &addr);
@@ -171,13 +155,11 @@ int user_start(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_NETMASK);
uip_setnetmask("eth0", &addr);
-#if defined(CONFIG_EXAMPLE_UIP_DHCPC)
+#ifdef CONFIG_EXAMPLE_UIP_DHCPC
/* Set up the resolver */
resolv_init();
-#endif
-#if defined(CONFIG_EXAMPLE_UIP_DHCPC)
/* Get the MAC address of the NIC */
uip_getmacaddr("eth0", mac);
@@ -210,25 +192,9 @@ int user_start(int argc, char *argv[])
}
#endif
-#if defined(CONFIG_EXAMPLE_UIP_WEBSERVER)
printf("Starting webserver\n");
httpd_init();
httpd_listen();
-#elif defined(CONFIG_EXAMPLE_UIP_TELNETD)
- printf("Starting telnetd\n");
- telnetd_init();
-#elif defined(CONFIG_EXAMPLE_UIP_SMTP)
- printf("Sending mail\n");
- uip_ipaddr(addr.s_addr, 127, 0, 0, 1);
- handle = smtp_open();
- if (handle)
- {
- smtp_configure(handle, g_host_name, &addr.s_addr);
- smtp_send(handle, g_recipient, NULL, g_sender, g_subject,
- g_msg_body, strlen(g_msg_body));
- smtp_close(handle);
- }
-#endif
while(1)
{
diff --git a/nuttx/examples/wget/host.c b/nuttx/examples/wget/host.c
index 40fda1af9..fe8109051 100644
--- a/nuttx/examples/wget/host.c
+++ b/nuttx/examples/wget/host.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/wget/host.c
*
- * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without