Fix examples/wget build

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1649 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-03-28 13:14:13 +00:00
parent 4bdf936730
commit 614277dd7c
18 changed files with 277 additions and 59 deletions

View file

@ -672,4 +672,6 @@
(submitted by JPelletier). The is the same fix that was needed for the
eZ80 and fixed in 0.4.2.
* netutils: Added logic to support a simple wget() function
* examples/wget: Added a test for wget()
* examples/wget: Added a test for wget() (Not yet tested because of
some current networking limitations).
* lib/strncasecmp: Fix cut'n'paste error in function name.

View file

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: March 25, 2009</p>
<p>Last Updated: March 28, 2009</p>
</td>
</tr>
</table>
@ -1363,7 +1363,9 @@ nuttx-0.4.4 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
(submitted by JPelletier). The is the same fix that was needed for the
eZ80 and fixed in 0.4.2.
* netutils: Added logic to support a simple wget() function
* examples/wget: Added a test for wget()
* examples/wget: Added a test for wget() (Not yet tested because of
some current networking limitations).
* lib/strncasecmp: Fix cut'n'paste error in function name.
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;

View file

@ -101,6 +101,16 @@ CONFIG_UART_MODEM_PARITY=0
CONFIG_UART_IRDA_2STOP=0
CONFIG_UART_MODEM_2STOP=0
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
#
# General build options
#
@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1)
CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information

View file

@ -101,6 +101,16 @@ CONFIG_UART_MODEM_PARITY=0
CONFIG_UART_IRDA_2STOP=0
CONFIG_UART_MODEM_2STOP=0
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
#
# General build options
#
@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1)
CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information

View file

@ -119,6 +119,16 @@ CONFIG_UART_MODEM_PARITY=0
CONFIG_UART_IRDA_2STOP=0
CONFIG_UART_MODEM_2STOP=0
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
#
# General OS setup
#
@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1)
CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information

View file

@ -101,6 +101,16 @@ CONFIG_UART_MODEM_PARITY=0
CONFIG_UART_IRDA_2STOP=0
CONFIG_UART_MODEM_2STOP=0
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
#
# General build options
#
@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1)
CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
#
# C5471 Ethernet Driver settings
CONFIG_C5471_NET_STATS=n
ETHERNET_PHY_LU3X31T_T64=1
ETHERNET_PHY_AC101L=2
CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
CONFIG_NET_C5471_AUTONEGOTIATION=y
CONFIG_NET_C5471_BASET100=n
CONFIG_NET_C5471_BASET10=n
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information

View file

@ -715,6 +715,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -763,6 +763,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -771,6 +771,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -224,7 +224,7 @@ CONFIG_HAVE_LIBM=n
# semaphore. This value may be set to zero if no more than one
# thread is expected to wait for a semaphore.
#
CONFIG_EXAMPLE=nettest
CONFIG_EXAMPLE=wget
CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_NET=n
@ -756,6 +756,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -756,6 +756,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -739,6 +739,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -756,6 +756,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
#
# Settings for examples/wget
# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
# CONFIG_EXAMPLE_WGET_NETMASK - Network mask
CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org"
CONFIG_EXAMPLE_WGET_FILENAME="/index.html"
CONFIG_EXAMPLE_WGET_NOMAC=y
CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
#
# Stack and heap information
#

View file

@ -308,7 +308,7 @@ examples/usbserial
serial messages.
examples/usbstorage
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^
This example registers a block device driver, then exports the block
the device using the USB storage class driver. Configuration options:
@ -347,3 +347,37 @@ examples/usbstorage
Error results are always shown in the trace output
examples/wget
^^^^^^^^^^^^^
A simple web client example. It will obtain a file from a server using the HTTP
protocol. Settings unique to this example include:
CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
CONFIG_EXAMPLE_WGET_NETMASK - Network mask
This example uses netutils/webclient. Additional configuration settings apply
to that code as follows (but built-in defaults are probably OK):
CONFIG_WEBCLIENT_GETMIMETYPE, CONFIG_WEBCLIENT_MAXHTTPLINE,
CONFIG_WEBCLIENT_MAXMIMESIZE, CONFIG_WEBCLIENT_MAXHOSTNAME,
CONFIG_WEBCLIENT_MAXFILENAME
Of course, the example also requires other settings including CONFIG_NET and
CONFIG_NET_TCP. The example also uses the uIP resolver which requires CONFIG_UDP.
WARNNG: As of this writing, wget is untested on the target platform. At present
it has been tested only in the host-based configuration described in the following
note. The primary difference is that the target version will rely on the also
untested uIP name resolver.
NOTE: For test purposes, this example can be built as a host-based wget function.
This can be built as follows:
cd examples/wget
make -f Makefile.host

View file

@ -40,7 +40,7 @@ include $(TOPDIR)/Make.defs
OBJS = host.o1 webclient.o1
BIN = wget
HOSTCFLAGS += -DCONFIG_NETUTILS_WEBCLIENT_HOST=1
HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1
HOSTCFLAGS += -I. -include hostdefs.h
VPATH = $(TOPDIR)/netutils/webclient:.

View file

@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@ -86,6 +87,21 @@
static char g_iobuffer[512];
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: callback
****************************************************************************/
static void callback(FAR char **buffer, int offset, int datend, FAR int *buflen)
{
(void)write(1, &((*buffer)[offset]), datend - offset);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* user_initialize
****************************************************************************/
@ -106,7 +122,6 @@ void user_initialize(void)
int user_start(int argc, char *argv[])
{
struct in_addr addr;
static uip_ipaddr_t addr;
#if defined(CONFIG_EXAMPLE_WGET_NOMAC)
uint8 mac[IFHWADDRLEN];
#endif

View file

@ -46,7 +46,7 @@
* Included Files
****************************************************************************/
#ifndef CONFIG_NETUTILS_WEBCLIENT_HOST
#ifndef CONFIG_WEBCLIENT_HOST
# include <nuttx/config.h>
#endif
#include <sys/types.h>
@ -55,20 +55,20 @@
* Pre-processor definitions
****************************************************************************/
#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXHTTPLINE
# define CONFIG_NETUTILS_WEBCLIENT_MAXHTTPLINE 200
#ifndef CONFIG_WEBCLIENT_MAXHTTPLINE
# define CONFIG_WEBCLIENT_MAXHTTPLINE 200
#endif
#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXMIMESIZE
# define CONFIG_NETUTILS_WEBCLIENT_MAXMIMESIZE 32
#ifndef CONFIG_WEBCLIENT_MAXMIMESIZE
# define CONFIG_WEBCLIENT_MAXMIMESIZE 32
#endif
#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME
# define CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME 40
#ifndef CONFIG_WEBCLIENT_MAXHOSTNAME
# define CONFIG_WEBCLIENT_MAXHOSTNAME 40
#endif
#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME
# define CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME 100
#ifndef CONFIG_WEBCLIENT_MAXFILENAME
# define CONFIG_WEBCLIENT_MAXFILENAME 100
#endif
/****************************************************************************

View file

@ -48,7 +48,7 @@
* Included Files
****************************************************************************/
#ifndef CONFIG_NETUTILS_WEBCLIENT_HOST
#ifndef CONFIG_WEBCLIENT_HOST
# include <nuttx/config.h>
# include <nuttx/compiler.h>
# include <debug.h>
@ -107,14 +107,14 @@ struct wget_s
/* Buffer HTTP header data and parse line at a time */
char line[CONFIG_NETUTILS_WEBCLIENT_MAXHTTPLINE];
char line[CONFIG_WEBCLIENT_MAXHTTPLINE];
int ndx;
#ifdef CONFIG_WEBCLIENT_GETMIMETYPE
char mimetype[CONFIG_NETUTILS_WEBCLIENT_MAXMIMESIZE];
char mimetype[CONFIG_WEBCLIENT_MAXMIMESIZE];
#endif
char hostname[CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME];
char filename[CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME];
char hostname[CONFIG_WEBCLIENT_MAXHOSTNAME];
char filename[CONFIG_WEBCLIENT_MAXFILENAME];
};
/****************************************************************************
@ -353,7 +353,7 @@ static inline int wget_parseheaders(struct wget_s *ws)
ws->hostname[i] = 0;
break;
}
else if (i < CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME-1)
else if (i < CONFIG_WEBCLIENT_MAXHOSTNAME-1)
{
ws->hostname[i] = *dest;
}
@ -362,12 +362,12 @@ static inline int wget_parseheaders(struct wget_s *ws)
/* Copy the location */
strncpy(ws->filename, dest, CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME-1);
strncpy(ws->filename, dest, CONFIG_WEBCLIENT_MAXFILENAME-1);
/* Make sure that everything is NULL terminated */
ws->hostname[CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME-1] = '\0';
ws->filename[CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME-1] = '\0';
ws->hostname[CONFIG_WEBCLIENT_MAXHOSTNAME-1] = '\0';
ws->filename[CONFIG_WEBCLIENT_MAXFILENAME-1] = '\0';
nvdbg("New hostname='%s' filename='%s'\n", ws->hostname, ws->filename);
}
}
@ -416,8 +416,8 @@ int wget(uint16 port,
memset(&ws, 0, sizeof(struct wget_s));
ws.buffer = buffer;
ws.buflen = buflen;
strncpy(ws.hostname, hostname, CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME);
strncpy(ws.filename, filename, CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME);
strncpy(ws.hostname, hostname, CONFIG_WEBCLIENT_MAXHOSTNAME);
strncpy(ws.filename, filename, CONFIG_WEBCLIENT_MAXFILENAME);
/* The following sequence may repeat indefinitely if we are redirected */