diff --git a/examples/Kconfig b/examples/Kconfig index 47b11b1e3..0578d46bb 100644 --- a/examples/Kconfig +++ b/examples/Kconfig @@ -65,7 +65,7 @@ source "$APPSDIR/examples/tiff/Kconfig" source "$APPSDIR/examples/touchscreen/Kconfig" source "$APPSDIR/examples/udp/Kconfig" source "$APPSDIR/examples/discover/Kconfig" -source "$APPSDIR/examples/uip/Kconfig" +source "$APPSDIR/examples/webserver/Kconfig" source "$APPSDIR/examples/usbserial/Kconfig" source "$APPSDIR/examples/usbterm/Kconfig" source "$APPSDIR/examples/watchdog/Kconfig" diff --git a/examples/Make.defs b/examples/Make.defs index 219c8df71..75d1662ce 100644 --- a/examples/Make.defs +++ b/examples/Make.defs @@ -282,8 +282,8 @@ ifeq ($(CONFIG_EXAMPLES_UDP),y) CONFIGURED_APPS += examples/udp endif -ifeq ($(CONFIG_EXAMPLES_UIP),y) -CONFIGURED_APPS += examples/uip +ifeq ($(CONFIG_EXAMPLES_WEBSERVER),y) +CONFIGURED_APPS += examples/webserver endif ifeq ($(CONFIG_EXAMPLES_USBSERIAL),y) diff --git a/examples/Makefile b/examples/Makefile index a4bca7dfe..48a328d4e 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -44,7 +44,7 @@ SUBDIRS += nrf24l01_term nsh null nx nxconsole nxffs nxflat nxhello nximage SUBDIRS += nxlines nxtext ostest pashello pipe poll posix_spawn pwm qencoder SUBDIRS += random relays rgmp romfs sendmail serialblaster serloop serialrx SUBDIRS += slcd smart smart_test tcpecho telnetd thttpd tiff touchscreen udp -SUBDIRS += uip usbserial usbterm watchdog wget wgetjson xmlrpc +SUBDIRS += usbserial usbterm watchdog webserver wget wgetjson xmlrpc # Sub-directories that might need context setup. Directories may need # context setup for a variety of reasons, but the most common is because diff --git a/examples/README.txt b/examples/README.txt index c743c38a9..e6bf986c2 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -182,7 +182,7 @@ examples/dhcpd (as well as various other UDP-related configuration settings) CONFIG_NET_BROADCAST=y - UDP broadcast support is needed. - CONFIG_NETUTILS_NETLIB=y - The UIP library is needed + CONFIG_NETUTILS_NETLIB=y - The networking library is needed CONFIG_EXAMPLES_DHCPD_NOMAC - (May be defined to use software assigned MAC) CONFIG_EXAMPLES_DHCPD_IPADDR - Target IP address @@ -490,7 +490,7 @@ examples/igmp * CONFIG_EXAMPLES_IGMP_GRPADDR Multicast group address * CONFIG_EXAMPLES_NETLIB - The UIP library is needed + The networking library is needed examples/adc ^^^^^^^^^^^^ @@ -670,7 +670,7 @@ examples/nettest functionality in a TCP/IP connection. CONFIG_EXAMPLES_NETTEST=y - Enables the nettest example - CONFIG_EXAMPLES_NETLIB=y - The UIP livrary in needed. + CONFIG_EXAMPLES_NETLIB=y - The networking library in needed. See also examples/tcpecho @@ -1218,7 +1218,7 @@ examples/poll If networking is enabled, applications using this example will need to provide the following definition in the defconfig file to enable the - UIP library: + networking library: CONFIG_NETUTILS_NETLIB=y @@ -1670,52 +1670,6 @@ examples/udp CONFIG_NETUTILS_NETLIB=y -examples/uip -^^^^^^^^^^^^ - - This is a port of uIP tiny webserver example application. Settings - specific to this example include: - - CONFIG_EXAMPLES_UIP_NOMAC - (May be defined to use software assigned MAC) - CONFIG_EXAMPLES_UIP_IPADDR - Target IP address - CONFIG_EXAMPLES_UIP_DRIPADDR - Default router IP addess - CONFIG_EXAMPLES_UIP_NETMASK - Network mask - CONFIG_EXAMPLES_UIP_DHCPC - Select to get IP address via DHCP - - If you use DHCPC, then some special configuration network options are - required. These include: - - CONFIG_NET=y - Of course - CONFIG_NSOCKET_DESCRIPTORS - And, of course, you must allocate some - socket descriptors. - CONFIG_NET_UDP=y - UDP support is required for DHCP - (as well as various other UDP-related - configuration settings). - CONFIG_NET_BROADCAST=y - UDP broadcast support is needed. - CONFIG_NET_BUFSIZE=650 - Per RFC2131 (p. 9), the DHCP client must be - (or larger) prepared to receive DHCP messages of up to - 576 bytes (excluding Ethernet, IP, or UDP - headers and FCS). - - 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 - CONFIG_NETUTILS_HTTPDNETSTATS - - Applications using this example will need to enable the following - netutils libraries in their defconfig file: - - CONFIG_NETUTILS_NETLIB=y - CONFIG_NETUTILS_DHCPC=y - CONFIG_NETUTILS_DNSCLIENT=y - CONFIG_NETUTILS_WEBSERVER=y - - NOTE: This example does depend on the perl script at - nuttx/tools/mkfsdata.pl. You must have perl installed on your - development system at /usr/bin/perl. - examples/usbserial ^^^^^^^^^^^^^^^^^^ @@ -1894,6 +1848,52 @@ examples/watchdog milliseconds before the watchdog timer expires. Default: 2000 milliseconds. +examples/webserver +^^^^^^^^^^^^^^^^^^ + + This is a port of uIP tiny webserver example application. Settings + specific to this example include: + + CONFIG_EXAMPLES_WEBSERVER_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLES_WEBSERVER_IPADDR - Target IP address + CONFIG_EXAMPLES_WEBSERVER_DRIPADDR - Default router IP addess + CONFIG_EXAMPLES_WEBSERVER_NETMASK - Network mask + CONFIG_EXAMPLES_WEBSERVER_DHCPC - Select to get IP address via DHCP + + If you use DHCPC, then some special configuration network options are + required. These include: + + CONFIG_NET=y - Of course + CONFIG_NSOCKET_DESCRIPTORS - And, of course, you must allocate some + socket descriptors. + CONFIG_NET_UDP=y - UDP support is required for DHCP + (as well as various other UDP-related + configuration settings). + CONFIG_NET_BROADCAST=y - UDP broadcast support is needed. + CONFIG_NET_BUFSIZE=650 - Per RFC2131 (p. 9), the DHCP client must be + (or larger) prepared to receive DHCP messages of up to + 576 bytes (excluding Ethernet, IP, or UDP + headers and FCS). + + 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 + CONFIG_NETUTILS_HTTPDNETSTATS + + Applications using this example will need to enable the following + netutils libraries in their defconfig file: + + CONFIG_NETUTILS_NETLIB=y + CONFIG_NETUTILS_DHCPC=y + CONFIG_NETUTILS_DNSCLIENT=y + CONFIG_NETUTILS_WEBSERVER=y + + NOTE: This example does depend on the perl script at + nuttx/tools/mkfsdata.pl. You must have perl installed on your + development system at /usr/bin/perl. + examples/wget ^^^^^^^^^^^^^ diff --git a/examples/udp/udp-internal.h b/examples/udp/udp-internal.h index c8010e6c8..da2be440a 100644 --- a/examples/udp/udp-internal.h +++ b/examples/udp/udp-internal.h @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __EXAMPLES_UIP_INTERNAL_H -#define __EXAMPLES_UIP_INTERNAL_H +#ifndef __EXAMPLES_UDP_INTERNAL_H +#define __EXAMPLES_UDP_INTERNAL_H /**************************************************************************** * Included Files @@ -87,4 +87,4 @@ extern void send_client(void); extern void recv_server(void); -#endif /* __EXAMPLES_UIP_INTERNAL_H */ +#endif /* __EXAMPLES_UDP_INTERNAL_H */ diff --git a/examples/uip/.gitignore b/examples/webserver/.gitignore similarity index 100% rename from examples/uip/.gitignore rename to examples/webserver/.gitignore diff --git a/examples/uip/Kconfig b/examples/webserver/Kconfig similarity index 77% rename from examples/uip/Kconfig rename to examples/webserver/Kconfig index e8478b73d..1a1323022 100644 --- a/examples/uip/Kconfig +++ b/examples/webserver/Kconfig @@ -3,33 +3,33 @@ # see misc/tools/kconfig-language.txt. # -config EXAMPLES_UIP +config EXAMPLES_WEBSERVER bool "uIP web server example" default n ---help--- Enable the uIP web server example -if EXAMPLES_UIP +if EXAMPLES_WEBSERVER -config EXAMPLES_UIP_IPADDR +config EXAMPLES_WEBSERVER_IPADDR hex "Device IP" default 0x0a000002 ---help--- This is the IP address of your board. -config EXAMPLES_UIP_DRIPADDR +config EXAMPLES_WEBSERVER_DRIPADDR hex "Default Router IP" default 0x0a000001 ---help--- This is the IP address of your router/gateway. -config EXAMPLES_UIP_NETMASK +config EXAMPLES_WEBSERVER_NETMASK hex "Network Mask" default 0xffffff00 ---help--- This is the network mask to use on this device. -config EXAMPLES_UIP_NOMAC +config EXAMPLES_WEBSERVER_NOMAC bool "No hardware MAC" default y ---help--- diff --git a/examples/uip/Makefile b/examples/webserver/Makefile similarity index 97% rename from examples/uip/Makefile rename to examples/webserver/Makefile index 11da70050..a1589936e 100644 --- a/examples/uip/Makefile +++ b/examples/webserver/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/uip/Makefile +# apps/examples/webserver/Makefile # # Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs # uIP very tiny web server example ASRCS = -CSRCS = uip_main.c cgi.c httpd_fsdata.c +CSRCS = webserver_main.c cgi.c httpd_fsdata.c AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) diff --git a/examples/uip/cgi.c b/examples/webserver/cgi.c similarity index 99% rename from examples/uip/cgi.c rename to examples/webserver/cgi.c index af579fb48..bdb290b7e 100644 --- a/examples/uip/cgi.c +++ b/examples/webserver/cgi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/uip/cgi.c + * apps/examples/webserver/cgi.c * Web server script interface * Author: Adam Dunkels * diff --git a/examples/uip/cgi.h b/examples/webserver/cgi.h similarity index 93% rename from examples/uip/cgi.h rename to examples/webserver/cgi.h index 8ad0f93ce..a71d306b3 100644 --- a/examples/uip/cgi.h +++ b/examples/webserver/cgi.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/uip/cgi.c + * apps/examples/webserver/cgi.h * Web server script interface header file * Author: Adam Dunkels * @@ -31,8 +31,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ +#ifndef __EXAMPLES_WEBSERVER_CGI_H +#define __EXAMPLES_WEBSERVER_CGI_H /**************************************************************************** * Public Function Prototypes @@ -40,4 +40,4 @@ void cgi_register(void); -#endif /* __HTTPD_CGI_H__ */ +#endif /* __EXAMPLES_WEBSERVER_CGI_H */ diff --git a/examples/uip/httpd-fs/.gitignore b/examples/webserver/httpd-fs/.gitignore similarity index 100% rename from examples/uip/httpd-fs/.gitignore rename to examples/webserver/httpd-fs/.gitignore diff --git a/examples/uip/httpd-fs/404.html b/examples/webserver/httpd-fs/404.html similarity index 100% rename from examples/uip/httpd-fs/404.html rename to examples/webserver/httpd-fs/404.html diff --git a/examples/uip/httpd-fs/fade.png b/examples/webserver/httpd-fs/fade.png similarity index 100% rename from examples/uip/httpd-fs/fade.png rename to examples/webserver/httpd-fs/fade.png diff --git a/examples/uip/httpd-fs/files.shtml b/examples/webserver/httpd-fs/files.shtml similarity index 100% rename from examples/uip/httpd-fs/files.shtml rename to examples/webserver/httpd-fs/files.shtml diff --git a/examples/uip/httpd-fs/footer.html b/examples/webserver/httpd-fs/footer.html similarity index 100% rename from examples/uip/httpd-fs/footer.html rename to examples/webserver/httpd-fs/footer.html diff --git a/examples/uip/httpd-fs/header.html b/examples/webserver/httpd-fs/header.html similarity index 100% rename from examples/uip/httpd-fs/header.html rename to examples/webserver/httpd-fs/header.html diff --git a/examples/uip/httpd-fs/index.shtml b/examples/webserver/httpd-fs/index.shtml similarity index 100% rename from examples/uip/httpd-fs/index.shtml rename to examples/webserver/httpd-fs/index.shtml diff --git a/examples/uip/httpd-fs/stats.shtml b/examples/webserver/httpd-fs/stats.shtml similarity index 100% rename from examples/uip/httpd-fs/stats.shtml rename to examples/webserver/httpd-fs/stats.shtml diff --git a/examples/uip/httpd-fs/style.css b/examples/webserver/httpd-fs/style.css similarity index 100% rename from examples/uip/httpd-fs/style.css rename to examples/webserver/httpd-fs/style.css diff --git a/examples/uip/httpd-fs/tcp.shtml b/examples/webserver/httpd-fs/tcp.shtml similarity index 100% rename from examples/uip/httpd-fs/tcp.shtml rename to examples/webserver/httpd-fs/tcp.shtml diff --git a/examples/uip/uip_main.c b/examples/webserver/webserver_main.c similarity index 89% rename from examples/uip/uip_main.c rename to examples/webserver/webserver_main.c index 1c974da95..15d162a30 100644 --- a/examples/uip/uip_main.c +++ b/examples/webserver/webserver_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/uip/uip_main.c + * examples/webserver/webserver_main.c * * Copyright (C) 2007, 2009-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -59,7 +59,7 @@ #include -#ifdef CONFIG_EXAMPLES_UIP_DHCPC +#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC #include #endif @@ -69,7 +69,7 @@ /* DHCPC may be used in conjunction with any other feature (or not) */ -#ifdef CONFIG_EXAMPLES_UIP_DHCPC +#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC # include # include #endif @@ -107,22 +107,22 @@ ****************************************************************************/ /**************************************************************************** - * uip_main + * webserver_main ****************************************************************************/ -int uip_main(int argc, char *argv[]) +int webserver_main(int argc, char *argv[]) { struct in_addr addr; -#if defined(CONFIG_EXAMPLES_UIP_DHCPC) || defined(CONFIG_EXAMPLES_UIP_NOMAC) +#if defined(CONFIG_EXAMPLES_WEBSERVER_DHCPC) || defined(CONFIG_EXAMPLES_WEBSERVER_NOMAC) uint8_t mac[IFHWADDRLEN]; #endif -#ifdef CONFIG_EXAMPLES_UIP_DHCPC +#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC void *handle; #endif /* Many embedded network interfaces must have a software assigned MAC */ -#ifdef CONFIG_EXAMPLES_UIP_NOMAC +#ifdef CONFIG_EXAMPLES_WEBSERVER_NOMAC mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0xde; @@ -134,24 +134,24 @@ int uip_main(int argc, char *argv[]) /* Set up our host address */ -#ifdef CONFIG_EXAMPLES_UIP_DHCPC +#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC addr.s_addr = 0; #else - addr.s_addr = HTONL(CONFIG_EXAMPLES_UIP_IPADDR); + addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_IPADDR); #endif netlib_sethostaddr("eth0", &addr); /* Set up the default router address */ - addr.s_addr = HTONL(CONFIG_EXAMPLES_UIP_DRIPADDR); + addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_DRIPADDR); netlib_setdraddr("eth0", &addr); /* Setup the subnet mask */ - addr.s_addr = HTONL(CONFIG_EXAMPLES_UIP_NETMASK); + addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_NETMASK); netlib_setnetmask("eth0", &addr); -#ifdef CONFIG_EXAMPLES_UIP_DHCPC +#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC /* Set up the resolver */ dns_bind(); @@ -205,7 +205,7 @@ int uip_main(int argc, char *argv[]) while (1) { sleep(3); - printf("uip_main: Still running\n"); + printf("webserver_main: Still running\n"); #if CONFIG_NFILE_DESCRIPTORS > 0 fflush(stdout); #endif