mirror of
https://github.com/apache/nuttx.git
synced 2025-12-09 19:54:55 +08:00
Several webserver bugs fixed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@391 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -230,3 +230,6 @@
|
||||
|
||||
0.3.2 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Add strcat() and strncat()
|
||||
* Integrated uIP micro webserver
|
||||
|
||||
|
||||
@@ -690,6 +690,9 @@ Other memory:
|
||||
|
||||
<pre><ul>
|
||||
0.3.2 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Add strcat() and strncat()
|
||||
* Integrated uIP micro webserver
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
|
||||
25
Makefile
25
Makefile
@@ -60,11 +60,17 @@ endif
|
||||
# MAKEDIRS are the directories in which we will build targets
|
||||
|
||||
CLEANDIRS = $(NONFSDIRS) $(FSDIRS)
|
||||
MAKEDIRS = $(NONFSDIRS)
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
MAKEDIRS = $(NONFSDIRS)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
MAKEDIRS += fs
|
||||
endif
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
MAKEDIRS += drivers
|
||||
endif
|
||||
else
|
||||
MAKEDIRS = $(NONFSDIRS) $(FSDIRS)
|
||||
MAKEDIRS += $(FSDIRS)
|
||||
endif
|
||||
|
||||
# LINKLIBS is the list of NuttX libraries that is passed to the
|
||||
@@ -75,14 +81,21 @@ endif
|
||||
LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \
|
||||
lib/liblib$(LIBEXT) examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
|
||||
|
||||
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
LINKLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
LINKLIBS += net/libnet$(LIBEXT) netutils/libnetutils$(LIBEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
LINKLIBS += fs/libfs$(LIBEXT)
|
||||
endif
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
LINKLIBS += drivers/libdrivers$(LIBEXT)
|
||||
endif
|
||||
else
|
||||
LINKLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT)
|
||||
endif
|
||||
|
||||
# This is the name of the final target
|
||||
BIN = nuttx$(EXEEXT)
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
|
||||
{
|
||||
int i;
|
||||
dbg(" TCB=%p name=%s\n", tcb, tcb->argv[0]);
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
if (tcb->filelist)
|
||||
{
|
||||
dbg(" filelist refcount=%d\n",
|
||||
@@ -92,7 +94,9 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_STREAMS > 0
|
||||
if (tcb->streams)
|
||||
{
|
||||
dbg(" streamlist refcount=%d\n",
|
||||
@@ -109,6 +113,7 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -129,7 +129,9 @@ void up_initialize(void)
|
||||
|
||||
/* Register devices */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
devnull_register(); /* Standard /dev/null */
|
||||
#endif
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
||||
|
||||
@@ -129,8 +129,13 @@ extern void up_vectorfiq(void);
|
||||
|
||||
/* Defined in up_serial.c */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
extern void up_earlyserialinit(void);
|
||||
extern void up_serialinit(void);
|
||||
#else
|
||||
# define up_earlyserialinit()
|
||||
# define up_serialinit()
|
||||
#endif
|
||||
|
||||
/* Defined in up_watchdog.c */
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@
|
||||
up_lowputc:
|
||||
/* On entry, r0 holds the character to be printed */
|
||||
|
||||
#ifdef CONFIG_UART0_SERIAL_CONSOLE
|
||||
ldr r2, =DM320_UART0_REGISTER_BASE /* r2=UART0 base */
|
||||
#else
|
||||
#ifdef CONFIG_UART1_SERIAL_CONSOLE
|
||||
ldr r2, =DM320_UART1_REGISTER_BASE /* r2=UART1 base */
|
||||
#else
|
||||
ldr r2, =DM320_UART0_REGISTER_BASE /* r2=UART0 base */
|
||||
#endif
|
||||
|
||||
/* Poll the TX fifo trigger level bit of the UART_SSR
|
||||
|
||||
@@ -38,20 +38,25 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/serial.h>
|
||||
#include <arch/serial.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
@@ -723,3 +728,59 @@ int up_putc(int ch)
|
||||
return ch;
|
||||
}
|
||||
|
||||
#else /* CONFIG_NFILE_DESCRIPTORS > 0 */
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
# ifdef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# define DM320_REGISTER_BASE DM320_UART1_REGISTER_BASE
|
||||
# else
|
||||
# define DM320_REGISTER_BASE DM320_UART0_REGISTER_BASE
|
||||
# endif
|
||||
|
||||
/************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
|
||||
static inline void up_waittxfifonotfull(void)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
for (tmp = 1000 ; tmp > 0 ; tmp--)
|
||||
{
|
||||
|
||||
if ((getreg16(DM320_REGISTER_BASE + UART_SR) & UART_SR_TFTI) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
up_waittxfifonotfull();
|
||||
putreg16((uint16)ch, DM320_REGISTER_BASE + UART_DTRR);
|
||||
|
||||
/* Check for LF */
|
||||
|
||||
if (ch == '\n')
|
||||
{
|
||||
/* Add CR */
|
||||
|
||||
up_waittxfifonotfull();
|
||||
putreg16((uint16)'\r', DM320_REGISTER_BASE + UART_DTRR);
|
||||
}
|
||||
|
||||
up_waittxfifonotfull();
|
||||
return ch;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
README
|
||||
^^^^^^
|
||||
|
||||
The configuration netconfig may be used instead of the
|
||||
default configuration (defconfig). This configuration
|
||||
enables networking using the OSDs DM9000A ethernet
|
||||
interface.
|
||||
defconfig
|
||||
^^^^^^^^^
|
||||
The default configuration file, defconfig, performs a
|
||||
simple OS test using examples/ostest. This can be
|
||||
configuration as follows:
|
||||
|
||||
cd tools
|
||||
./configure.sh ntosd-dm320
|
||||
cd -
|
||||
. ./setenv.sh
|
||||
|
||||
netconfig
|
||||
^^^^^^^^^
|
||||
The alternative configuration file, netconfig, may be used
|
||||
instead of the default configuration (defconfig). This
|
||||
configuration enables networking using the OSDs DM9000A
|
||||
Ethernet interface. It uses examples/nettest to excercise
|
||||
the network.
|
||||
|
||||
uipconfig
|
||||
^^^^^^^^^
|
||||
This configuration file demonstrates the tiny webserver
|
||||
at examples/uip.
|
||||
|
||||
These alternative configurations can be selected by
|
||||
|
||||
(Seleted the default configuration as show above)
|
||||
cp config/ntosd-dm320/uiponfig .config
|
||||
|
||||
Disclaimer: The NuttX network subsystem is a "work in
|
||||
progress" at this time and minimal network functionality
|
||||
should be expected.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
############################################################
|
||||
# defconfig
|
||||
# arch/ntosd-dm320/netconfig
|
||||
#
|
||||
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
@@ -126,7 +126,6 @@ CONFIG_UART1_2STOP=0
|
||||
# CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
# provides /dev/console. Enables stdout, stderr, stdin.
|
||||
#
|
||||
#CONFIG_EXAMPLE=uip
|
||||
CONFIG_EXAMPLE=nettest
|
||||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
@@ -158,9 +157,9 @@ CONFIG_DEV_CONSOLE=y
|
||||
#
|
||||
CONFIG_DISABLE_CLOCK=n
|
||||
CONFIG_DISABLE_POSIX_TIMERS=n
|
||||
CONFIG_DISABLE_PTHREAD=n
|
||||
CONFIG_DISABLE_PTHREAD=y
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_ENVIRON=y
|
||||
|
||||
@@ -237,15 +236,15 @@ CONFIG_RRLOAD_BINARY=n
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_MAX_TASK_ARGS=4
|
||||
CONFIG_NPTHREAD_KEYS=4
|
||||
CONFIG_NFILE_DESCRIPTORS=32
|
||||
CONFIG_NFILE_STREAMS=16
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NAME_MAX=32
|
||||
CONFIG_STDIO_BUFFER_SIZE=1024
|
||||
CONFIG_NUNGET_CHARS=2
|
||||
CONFIG_PREALLOC_MQ_MSGS=32
|
||||
CONFIG_MQ_MAXMSGSIZE=32
|
||||
CONFIG_MAX_WDOGPARMS=4
|
||||
CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_WDOGS=8
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
|
||||
351
configs/ntosd-dm320/uipconfig
Normal file
351
configs/ntosd-dm320/uipconfig
Normal file
@@ -0,0 +1,351 @@
|
||||
############################################################
|
||||
# arch/ntosd-dm320/uipconfig
|
||||
#
|
||||
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################
|
||||
#
|
||||
# architecture selection
|
||||
#
|
||||
# CONFIG_ARCH - identifies the arch subdirectory and, hence, the
|
||||
# processor architecture.
|
||||
# CONFIG_ARCH_name - for use in C code. This identifies the
|
||||
# particular chip or SoC that the architecture is implemented
|
||||
# in.
|
||||
# CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
||||
# CONFIG_ARCH_CHIP_name - For use in C code
|
||||
# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
|
||||
# the board that supports the particular chip or SoC.
|
||||
# CONFIG_ARCH_BOARD_name - for use in C code
|
||||
# CONFIG_ENDIAN_BIG - define if big endian (default is little endian)
|
||||
# CONFIG_BOARD_LOOPSPERMSEC - for delay loops
|
||||
# CONFIG_DRAM_SIZE - Describes the installed DRAM.
|
||||
# CONFIG_DRAM_START - The start address of DRAM (physical)
|
||||
# CONFIG_DRAM_VSTART - The startaddress of DRAM (virtual)
|
||||
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||
#
|
||||
CONFIG_ARCH=arm
|
||||
CONFIG_ARCH_ARM=y
|
||||
CONFIG_ARCH_CHIP=dm320
|
||||
CONFIG_ARCH_CHIP_DM320=y
|
||||
CONFIG_ARCH_BOARD=ntosd-dm320
|
||||
CONFIG_ARCH_BOARD_NTOSD_DM320=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16945
|
||||
CONFIG_DRAM_SIZE=0x01000000
|
||||
CONFIG_DRAM_START=0x01000000
|
||||
CONFIG_DRAM_VSTART=0x00000000
|
||||
CONFIG_DRAM_NUTTXENTRY=0x01008000
|
||||
CONFIG_ARCH_STACKDUMP=n
|
||||
|
||||
#
|
||||
# DM320 specific device driver settings
|
||||
#
|
||||
# CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
|
||||
# console and ttys0 (default is the UART0).
|
||||
# CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
|
||||
# This specific the size of the receive buffer
|
||||
# CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
|
||||
# being sent. This specific the size of the transmit buffer
|
||||
# CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
|
||||
# CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
|
||||
# CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
|
||||
# CONFIG_UARTn_2STOP - Two stop bits
|
||||
#
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_UART1_SERIAL_CONSOLE=n
|
||||
CONFIG_UART0_TXBUFSIZE=256
|
||||
CONFIG_UART1_TXBUFSIZE=256
|
||||
CONFIG_UART0_RXBUFSIZE=256
|
||||
CONFIG_UART1_RXBUFSIZE=256
|
||||
CONFIG_UART0_BAUD=115200
|
||||
CONFIG_UART1_BAUD=115200
|
||||
CONFIG_UART0_BITS=8
|
||||
CONFIG_UART1_BITS=8
|
||||
CONFIG_UART0_PARITY=0
|
||||
CONFIG_UART1_PARITY=0
|
||||
CONFIG_UART0_2STOP=0
|
||||
CONFIG_UART1_2STOP=0
|
||||
|
||||
#
|
||||
# General OS setup
|
||||
#
|
||||
# CONFIG_EXAMPLE - identifies the subdirectory in examples
|
||||
# that will be used in the build
|
||||
# CONFIG_DEBUG - enables built-in debug options
|
||||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
# CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
# regions of memory to allocate from, this specifies the
|
||||
# number of memory regions that the memory manager must
|
||||
# handle and enables the API mm_addregion(start, end);
|
||||
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
|
||||
# time console output
|
||||
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
|
||||
# or TICKS_PER_MSEC=10. This setting may be defined to
|
||||
# inform NuttX that the processor hardware is providing
|
||||
# system timer interrupts at some interrupt interval other
|
||||
# than 10 msec.
|
||||
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
|
||||
# this number of milliseconds; Round robin scheduling can
|
||||
# be disabled by setting this value to zero.
|
||||
# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
|
||||
# scheduler to monitor system performance
|
||||
# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a
|
||||
# task name to save in the TCB. Useful if scheduler
|
||||
# instrumentation is selected. Set to zero to disable.
|
||||
# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
|
||||
# Used to initialize the internal time logic.
|
||||
# CONFIG_JULIAN_TIME - Enables Julian time conversions
|
||||
# CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
# provides /dev/console. Enables stdout, stderr, stdin.
|
||||
#
|
||||
CONFIG_EXAMPLE=uip
|
||||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
CONFIG_MM_REGIONS=1
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_INSTRUMENTATION=n
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_START_YEAR=2007
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_DAY=13
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=n
|
||||
|
||||
#
|
||||
# The following can be used to disable categories of
|
||||
# APIs supported by the OS. If the compiler supports
|
||||
# weak functions, then it should not be necessary to
|
||||
# disable functions unless you want to restrict usage
|
||||
# of those APIs.
|
||||
#
|
||||
# There are certain dependency relationships in these
|
||||
# features.
|
||||
#
|
||||
# o mq_notify logic depends on signals to awaken tasks
|
||||
# waiting for queues to become full or empty.
|
||||
# o pthread_condtimedwait() depends on signals to wake
|
||||
# up waiting tasks.
|
||||
#
|
||||
CONFIG_DISABLE_CLOCK=n
|
||||
CONFIG_DISABLE_POSIX_TIMERS=n
|
||||
CONFIG_DISABLE_PTHREAD=n
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_ENVIRON=y
|
||||
|
||||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
# little smaller if we do not support fieldwidthes
|
||||
#
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
# The architecture can provide optimized versions of the
|
||||
# following to improve sysem performance
|
||||
#
|
||||
CONFIG_ARCH_MEMCPY=n
|
||||
CONFIG_ARCH_MEMCMP=n
|
||||
CONFIG_ARCH_MEMMOVE=n
|
||||
CONFIG_ARCH_MEMSET=n
|
||||
CONFIG_ARCH_STRCMP=n
|
||||
CONFIG_ARCH_STRCPY=n
|
||||
CONFIG_ARCH_STRNCPY=n
|
||||
CONFIG_ARCH_STRLEN=n
|
||||
CONFIG_ARCH_BZERO=n
|
||||
CONFIG_ARCH_KMALLOC=n
|
||||
CONFIG_ARCH_KZMALLOC=n
|
||||
CONFIG_ARCH_KFREE=n
|
||||
|
||||
#
|
||||
# General build options
|
||||
#
|
||||
# CONFIG_RRLOAD_BINARY - make the rrload binary format used with
|
||||
# BSPs from www.ridgerun.com
|
||||
#
|
||||
CONFIG_RRLOAD_BINARY=n
|
||||
|
||||
#
|
||||
# Sizes of configurable things (0 disables)
|
||||
#
|
||||
# CONFIG_MAX_TASKS - The maximum number of simultaneously
|
||||
# active tasks. This value must be a power of two.
|
||||
# CONFIG_MAX_TASK_ARGS - This controls the maximum number of
|
||||
# of parameters that a task may receive (i.e., maxmum value
|
||||
# of 'argc')
|
||||
# CONFIG_NPTHREAD_KEYS - The number of items of thread-
|
||||
# specific data that can be retained
|
||||
# CONFIG_NFILE_DESCRIPTORS - The maximum number of file
|
||||
# descriptors (one for each open)
|
||||
# CONFIG_NFILE_STREAMS - The maximum number of streams that
|
||||
# can be fopen'ed
|
||||
# CONFIG_NAME_MAX - The maximum size of a file name.
|
||||
# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
|
||||
# on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_NUNGET_CHARS - Number of characters that can be
|
||||
# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
|
||||
# structures. The system manages a pool of preallocated
|
||||
# message structures to minimize dynamic allocations
|
||||
# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
|
||||
# a fixed payload size given by this settin (does not include
|
||||
# other message structure overhead.
|
||||
# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that
|
||||
# can be passed to a watchdog handler
|
||||
# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
|
||||
# structures. The system manages a pool of preallocated
|
||||
# watchdog structures to minimize dynamic allocations
|
||||
# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX
|
||||
# timer structures. The system manages a pool of preallocated
|
||||
# timer structures to minimize dynamic allocations. Set to
|
||||
# zero for all dynamic allocations.
|
||||
#
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_TASK_ARGS=4
|
||||
CONFIG_NPTHREAD_KEYS=4
|
||||
CONFIG_NFILE_DESCRIPTORS=0
|
||||
CONFIG_NFILE_STREAMS=0
|
||||
CONFIG_NAME_MAX=32
|
||||
CONFIG_STDIO_BUFFER_SIZE=1024
|
||||
CONFIG_NUNGET_CHARS=2
|
||||
CONFIG_PREALLOC_MQ_MSGS=0
|
||||
CONFIG_MQ_MAXMSGSIZE=32
|
||||
CONFIG_MAX_WDOGPARMS=4
|
||||
CONFIG_PREALLOC_WDOGS=8
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=8
|
||||
CONFIG_NET_TCP_CONNS=8
|
||||
CONFIG_NET_MAX_LISTENPORTS=8
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=n
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
CONFIG_EXAMPLE_UIP_SMTP=n
|
||||
CONFIG_EXAMPLE_UIP_TELNETD=n
|
||||
CONFIG_EXAMPLE_UIP_WEBSERVER=y
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
CONFIG_EXAMPLE_UIP_RESOLV=n
|
||||
CONFIG_EXAMPLE_UIP_WEBCLIENT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1)
|
||||
|
||||
#
|
||||
# DM90x0 Driver Settings
|
||||
CONFIG_NET_DM90x0=y
|
||||
CONFIG_DM9X_NINTERFACES=1
|
||||
CONFIG_DM9X_STATS=n
|
||||
CONFIG_DM9X_BASE=0xd0000300
|
||||
CONFIG_DM9X_IRQ=27
|
||||
CONFIG_DM9X_BUSWIDTH8=n
|
||||
CONFIG_DM9X_BUSWIDTH16=y
|
||||
CONFIG_DM9X_BUSWIDTH32=n
|
||||
CONFIG_DM9X_CHECKSUM=n
|
||||
CONFIG_DM9X_ETRANS=n
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
#
|
||||
# CONFIG_BOOT_FROM_FLASH - Some configurations support XIP
|
||||
# operation from FLASH.
|
||||
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
|
||||
# all stack operations outside of the nuttx model.
|
||||
# CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
|
||||
# CONFIG_PROC_STACK_SIZE - The size of the initial stack
|
||||
# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
|
||||
# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
|
||||
# CONFIG_HEAP_BASE - The beginning of the heap
|
||||
# CONFIG_HEAP_SIZE - The size of the heap
|
||||
#
|
||||
CONFIG_BOOT_FROM_FLASH=n
|
||||
CONFIG_CUSTOM_STACK=n
|
||||
CONFIG_STACK_POINTER=
|
||||
CONFIG_PROC_STACK_SIZE=4096
|
||||
CONFIG_PTHREAD_STACK_MIN=256
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=4096
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
@@ -44,7 +44,11 @@ endif
|
||||
ASRCS = $(NET_ASRCS)
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = dev_null.c serial.c $(NET_CSRCS)
|
||||
CSRCS =
|
||||
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
CSRCS += dev_null.c serial.c
|
||||
endif
|
||||
CSRCS += $(NET_CSRCS)
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
|
||||
31
fs/Makefile
31
fs/Makefile
@@ -1,5 +1,5 @@
|
||||
############################################################
|
||||
# Makefile
|
||||
############################################################################
|
||||
# fs/Makefile
|
||||
#
|
||||
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
@@ -31,7 +31,7 @@
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
@@ -40,22 +40,29 @@ MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = fs_open.c fs_close.c fs_read.c fs_write.c fs_ioctl.c fs_dup.c \
|
||||
fs_opendir.c fs_closedir.c fs_stat.c fs_readdir.c fs_readdirr.c \
|
||||
fs_seekdir.c fs_telldir.c fs_rewinddir.c fs_files.c \
|
||||
fs_inode.c fs_inodefind.c fs_inodereserve.c fs_statfs.c \
|
||||
fs_inoderemove.c fs_registerdriver.c fs_unregisterdriver.c \
|
||||
fs_inodeaddref.c fs_inoderelease.c
|
||||
CSRCS =
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
CSRCS += fs_close.c fs_write.c fs_ioctl.c
|
||||
endif
|
||||
else
|
||||
CSRCS += fs_open.c fs_close.c fs_read.c fs_write.c fs_ioctl.c fs_dup.c \
|
||||
fs_opendir.c fs_closedir.c fs_stat.c fs_readdir.c fs_readdirr.c \
|
||||
fs_seekdir.c fs_telldir.c fs_rewinddir.c fs_files.c \
|
||||
fs_inode.c fs_inodefind.c fs_inodereserve.c fs_statfs.c \
|
||||
fs_inoderemove.c fs_registerdriver.c fs_unregisterdriver.c \
|
||||
fs_inodeaddref.c fs_inoderelease.c
|
||||
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
|
||||
CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \
|
||||
fs_mount.c fs_umount.c \
|
||||
fs_fsync.c fs_unlink.c fs_rename.c \
|
||||
fs_mkdir.c fs_rmdir.c
|
||||
fs_mount.c fs_umount.c \
|
||||
fs_fsync.c fs_unlink.c fs_rename.c \
|
||||
fs_mkdir.c fs_rmdir.c
|
||||
|
||||
ifeq ($(CONFIG_FS_FAT),y)
|
||||
CSRCS += fs_fat32.c fs_fat32util.c fs_fat32attrib.c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/************************************************************
|
||||
* fs_write.c
|
||||
/****************************************************************************
|
||||
* fs/fs_write.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
@@ -31,15 +31,15 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
@@ -54,11 +54,11 @@
|
||||
|
||||
#include "fs_internal.h"
|
||||
|
||||
/************************************************************
|
||||
* Global Functions
|
||||
************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Function: send
|
||||
*
|
||||
* Description:
|
||||
@@ -106,15 +106,17 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
********************************************************************************************/
|
||||
|
||||
int write(int fd, const void *buf, unsigned int nbytes)
|
||||
{
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
FAR struct filelist *list;
|
||||
FAR struct file *this_file;
|
||||
FAR struct inode *inode;
|
||||
int err;
|
||||
int ret;
|
||||
#endif
|
||||
int err;
|
||||
|
||||
/* Did we get a valid file descriptor? */
|
||||
|
||||
@@ -135,6 +137,8 @@ int write(int fd, const void *buf, unsigned int nbytes)
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
||||
/* Get the thread-specific file list */
|
||||
|
||||
list = sched_getfiles();
|
||||
@@ -172,6 +176,7 @@ int write(int fd, const void *buf, unsigned int nbytes)
|
||||
}
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
errout:
|
||||
*get_errno_ptr() = err;
|
||||
|
||||
@@ -63,6 +63,7 @@ EXTERN char *strchr(const char *s, int c);
|
||||
EXTERN FAR char *strdup(const char *s);
|
||||
EXTERN const char *strerror(int);
|
||||
EXTERN size_t strlen(const char *);
|
||||
EXTERN char *strcat(char *, const char *);
|
||||
EXTERN char *strncat(char *, const char *, size_t);
|
||||
EXTERN int strcmp(const char *, const char *);
|
||||
EXTERN int strncmp(const char *, const char *, size_t);
|
||||
|
||||
@@ -125,7 +125,7 @@ static void file_stats(struct httpd_state *pstate, char *ptr)
|
||||
char buffer[16];
|
||||
char *pcount = strchr(ptr, ' ') + 1;
|
||||
snprintf(buffer, 16, "%5u", httpd_fs_count(pcount));
|
||||
(void)send(pstate->sockfd, buffer, strlen(buffer), 0);
|
||||
(void)send(pstate->ht_sockfd, buffer, strlen(buffer), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,23 +60,23 @@ static uint16 count[HTTPD_FS_NUMFILES];
|
||||
|
||||
static uint8 httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
{
|
||||
uint8 i;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
loop:
|
||||
for (;;)
|
||||
{
|
||||
if (str2[i] == 0 || str1[i] == '\r' || str1[i] == '\n')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(str2[i] == 0 ||
|
||||
str1[i] == '\r' ||
|
||||
str1[i] == '\n') {
|
||||
return 0;
|
||||
}
|
||||
if (str1[i] != str2[i])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(str1[i] != str2[i]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
++i;
|
||||
goto loop;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
int httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
@@ -88,21 +88,21 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
|
||||
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
|
||||
f != NULL;
|
||||
f = (struct httpd_fsdata_file_noconst *)f->next) {
|
||||
|
||||
if(httpd_fs_strcmp(name, f->name) == 0) {
|
||||
file->data = f->data;
|
||||
file->len = f->len;
|
||||
f = (struct httpd_fsdata_file_noconst *)f->next)
|
||||
{
|
||||
if (httpd_fs_strcmp(name, f->name) == 0)
|
||||
{
|
||||
file->data = f->data;
|
||||
file->len = f->len;
|
||||
#if HTTPD_FS_STATISTICS
|
||||
++count[i];
|
||||
++count[i];
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
return 1;
|
||||
}
|
||||
#if HTTPD_FS_STATISTICS
|
||||
++i;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
return 1;
|
||||
}
|
||||
#if HTTPD_FS_STATISTICS
|
||||
++i;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -110,9 +110,10 @@ void httpd_fs_init(void)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
uint16 i;
|
||||
for(i = 0; i < HTTPD_FS_NUMFILES; i++) {
|
||||
count[i] = 0;
|
||||
}
|
||||
for(i = 0; i < HTTPD_FS_NUMFILES; i++)
|
||||
{
|
||||
count[i] = 0;
|
||||
}
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
}
|
||||
|
||||
@@ -125,13 +126,14 @@ uint16 httpd_fs_count(char *name)
|
||||
i = 0;
|
||||
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
|
||||
f != NULL;
|
||||
f = (struct httpd_fsdata_file_noconst *)f->next) {
|
||||
|
||||
if(httpd_fs_strcmp(name, f->name) == 0) {
|
||||
return count[i];
|
||||
f = (struct httpd_fsdata_file_noconst *)f->next)
|
||||
{
|
||||
if (httpd_fs_strcmp(name, f->name) == 0)
|
||||
{
|
||||
return count[i];
|
||||
}
|
||||
++i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
|
||||
@@ -583,34 +583,34 @@ static const unsigned char data_stats_shtml[] = {
|
||||
0xa, 0};
|
||||
|
||||
const struct httpd_fsdata_file file_processes_shtml[] =
|
||||
{{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 17}};
|
||||
{{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 18}};
|
||||
|
||||
const struct httpd_fsdata_file file_404_html[] =
|
||||
{{file_processes_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};
|
||||
{{file_processes_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 11}};
|
||||
|
||||
const struct httpd_fsdata_file file_files_shtml[] =
|
||||
{{file_404_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 13}};
|
||||
{{file_404_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 14}};
|
||||
|
||||
const struct httpd_fsdata_file file_footer_html[] =
|
||||
{{file_files_shtml, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 13}};
|
||||
{{file_files_shtml, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 14}};
|
||||
|
||||
const struct httpd_fsdata_file file_header_html[] =
|
||||
{{file_footer_html, data_header_html, data_header_html + 13, sizeof(data_header_html) - 13}};
|
||||
{{file_footer_html, data_header_html, data_header_html + 13, sizeof(data_header_html) - 14}};
|
||||
|
||||
const struct httpd_fsdata_file file_index_html[] =
|
||||
{{file_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};
|
||||
{{file_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 13}};
|
||||
|
||||
const struct httpd_fsdata_file file_style_css[] =
|
||||
{{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 11}};
|
||||
{{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 12}};
|
||||
|
||||
const struct httpd_fsdata_file file_tcp_shtml[] =
|
||||
{{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}};
|
||||
{{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 12}};
|
||||
|
||||
const struct httpd_fsdata_file file_fade_png[] =
|
||||
{{file_tcp_shtml, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 10}};
|
||||
{{file_tcp_shtml, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 11}};
|
||||
|
||||
const struct httpd_fsdata_file file_stats_shtml[] =
|
||||
{{file_fade_png, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 13}};
|
||||
{{file_fade_png, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 14}};
|
||||
|
||||
#define HTTPD_FS_ROOT file_stats_shtml
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
|
||||
#include "httpd.h"
|
||||
#include "httpd-cgi.h"
|
||||
#include "netutil-strings.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@@ -80,13 +79,48 @@
|
||||
#define errno *get_errno_ptr()
|
||||
|
||||
#define CONFIG_NETUTILS_HTTPD_DUMPBUFFER 1
|
||||
#undef CONFIG_NETUTILS_HTTPD_DUMPPSTATE
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const char g_httpcontenttypebinary[] = "Content-type: application/octet-stream\r\n\r\n";
|
||||
static const char g_httpcontenttypecss[] = "Content-type: text/css\r\n\r\n";
|
||||
static const char g_httpcontenttypegif[] = "Content-type: image/gif\r\n\r\n";
|
||||
static const char g_httpcontenttypehtml[] = "Content-type: text/html\r\n\r\n";
|
||||
static const char g_httpcontenttypejpg[] = "Content-type: image/jpeg\r\n\r\n";
|
||||
static const char g_httpcontenttypeplain[] = "Content-type: text/plain\r\n\r\n";
|
||||
static const char g_httpcontenttypepng[] = "Content-type: image/png\r\n\r\n";
|
||||
|
||||
static const char g_httpextensionhtml[] = ".html";
|
||||
static const char g_httpextensionshtml[] = ".shtml";
|
||||
static const char g_httpextensioncss[] = ".css";
|
||||
static const char g_httpextensionpng[] = ".png";
|
||||
static const char g_httpextensiongif[] = ".gif";
|
||||
static const char g_httpextensionjpg[] = ".jpg";
|
||||
|
||||
static const char g_http404path[] = "/404.html";
|
||||
static const char g_httpindexpath[] = "/index.html";
|
||||
|
||||
static const char g_httpcmdget[] = "GET ";
|
||||
|
||||
static const char g_httpheader200[] =
|
||||
"HTTP/1.0 200 OK\r\n"
|
||||
"Server: uIP/1.0 http://www.sics.se/~adam/uip/\r\n"
|
||||
"Connection: close\r\n";
|
||||
|
||||
static const char g_httpheader404[] =
|
||||
"HTTP/1.0 404 Not found\r\n"
|
||||
"Server: uIP/1.0 http://www.sics.se/~adam/uip/\r\n"
|
||||
"Connection: close\r\n";
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NETUTILS_HTTPD_DUMPBUFFER
|
||||
static void httpd_dumpbuffer(struct httpd_state *pstate, ssize_t nbytes)
|
||||
static void httpd_dumpbuffer(const char *buffer, ssize_t nbytes)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG
|
||||
char line[128];
|
||||
@@ -101,7 +135,7 @@ static void httpd_dumpbuffer(struct httpd_state *pstate, ssize_t nbytes)
|
||||
{
|
||||
if (i + j < nbytes)
|
||||
{
|
||||
sprintf(&line[strlen(line)], "%02x ", pstate->ht_buffer[i+j] );
|
||||
sprintf(&line[strlen(line)], "%02x ", buffer[i+j] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,7 +146,7 @@ static void httpd_dumpbuffer(struct httpd_state *pstate, ssize_t nbytes)
|
||||
{
|
||||
if (i + j < nbytes)
|
||||
{
|
||||
ch = pstate->ht_buffer[i+j];
|
||||
ch = buffer[i+j];
|
||||
sprintf(&line[strlen(line)], "%c", ch >= 0x20 && ch <= 0x7e ? ch : '.');
|
||||
}
|
||||
}
|
||||
@@ -121,37 +155,55 @@ static void httpd_dumpbuffer(struct httpd_state *pstate, ssize_t nbytes)
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
# define httpd_dumpbuffer(pstate,nbytes)
|
||||
# define httpd_dumpbuffer(buffer,nbytes)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETUTILS_HTTPD_DUMPPSTATE
|
||||
static void httpd_dumppstate(struct httpd_state *pstate, const char *msg)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG
|
||||
dbg("[%d] pstate(%p): [%s]\n", pstate->ht_sockfd, pstate, msg);
|
||||
dbg(" filename: [%s]\n", pstate->ht_filename);
|
||||
dbg(" htfile len: %d\n", pstate->ht_file.len);
|
||||
dbg(" sockfd: %d\n", pstate->ht_sockfd);
|
||||
dbg(" scriptptr: %p\n", pstate->ht_scriptptr);
|
||||
dbg(" scriptlen: %d\n", pstate->ht_scriptlen);
|
||||
dbg(" sndlen: %d\n", pstate->ht_sndlen);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
# define httpd_dumppstate(pstate, msg)
|
||||
#endif
|
||||
|
||||
static void next_scriptstate(struct httpd_state *pstate)
|
||||
{
|
||||
char *p;
|
||||
p = strchr(pstate->scriptptr, ISO_nl) + 1;
|
||||
pstate->scriptlen -= (unsigned short)(p - pstate->scriptptr);
|
||||
pstate->scriptptr = p;
|
||||
p = strchr(pstate->ht_scriptptr, ISO_nl) + 1;
|
||||
pstate->ht_scriptlen -= (unsigned short)(p - pstate->ht_scriptptr);
|
||||
pstate->ht_scriptptr = p;
|
||||
}
|
||||
|
||||
static void handle_script(struct httpd_state *pstate)
|
||||
static int handle_script(struct httpd_state *pstate)
|
||||
{
|
||||
int len;
|
||||
char *ptr;
|
||||
|
||||
while(pstate->file.len > 0)
|
||||
while(pstate->ht_file.len > 0)
|
||||
{
|
||||
/* Check if we should start executing a script */
|
||||
|
||||
if (*pstate->file.data == ISO_percent && *(pstate->file.data + 1) == ISO_bang)
|
||||
if (*pstate->ht_file.data == ISO_percent && *(pstate->ht_file.data + 1) == ISO_bang)
|
||||
{
|
||||
pstate->scriptptr = pstate->file.data + 3;
|
||||
pstate->scriptlen = pstate->file.len - 3;
|
||||
if (*(pstate->scriptptr - 1) == ISO_colon)
|
||||
pstate->ht_scriptptr = pstate->ht_file.data + 3;
|
||||
pstate->ht_scriptlen = pstate->ht_file.len - 3;
|
||||
if (*(pstate->ht_scriptptr - 1) == ISO_colon)
|
||||
{
|
||||
httpd_fs_open(pstate->scriptptr + 1, &pstate->file);
|
||||
send(pstate->sockfd, pstate->file.data, pstate->file.len, 0);
|
||||
httpd_fs_open(pstate->ht_scriptptr + 1, &pstate->ht_file);
|
||||
send(pstate->ht_sockfd, pstate->ht_file.data, pstate->ht_file.len, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
httpd_cgi(pstate->scriptptr)(pstate, pstate->scriptptr);
|
||||
httpd_cgi(pstate->ht_scriptptr)(pstate, pstate->ht_scriptptr);
|
||||
}
|
||||
next_scriptstate(pstate);
|
||||
|
||||
@@ -159,8 +211,8 @@ static void handle_script(struct httpd_state *pstate)
|
||||
* sending the rest of the file
|
||||
*/
|
||||
|
||||
pstate->file.data = pstate->scriptptr;
|
||||
pstate->file.len = pstate->scriptlen;
|
||||
pstate->ht_file.data = pstate->ht_scriptptr;
|
||||
pstate->ht_file.len = pstate->ht_scriptlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,102 +220,179 @@ static void handle_script(struct httpd_state *pstate)
|
||||
* to be sent
|
||||
*/
|
||||
|
||||
if (pstate->file.len > HTTPD_IOBUFFER_SIZE)
|
||||
if (pstate->ht_file.len > HTTPD_IOBUFFER_SIZE)
|
||||
{
|
||||
pstate->len = HTTPD_IOBUFFER_SIZE;
|
||||
len = HTTPD_IOBUFFER_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstate->len = pstate->file.len;
|
||||
len = pstate->ht_file.len;
|
||||
}
|
||||
|
||||
if (*pstate->file.data == ISO_percent)
|
||||
if (*pstate->ht_file.data == ISO_percent)
|
||||
{
|
||||
ptr = strchr(pstate->file.data + 1, ISO_percent);
|
||||
ptr = strchr(pstate->ht_file.data + 1, ISO_percent);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = strchr(pstate->file.data, ISO_percent);
|
||||
ptr = strchr(pstate->ht_file.data, ISO_percent);
|
||||
}
|
||||
|
||||
if (ptr != NULL && ptr != pstate->file.data)
|
||||
if (ptr != NULL && ptr != pstate->ht_file.data)
|
||||
{
|
||||
pstate->len = (int)(ptr - pstate->file.data);
|
||||
if (pstate->len >= HTTPD_IOBUFFER_SIZE)
|
||||
len = (int)(ptr - pstate->ht_file.data);
|
||||
if (len >= HTTPD_IOBUFFER_SIZE)
|
||||
{
|
||||
pstate->len = HTTPD_IOBUFFER_SIZE;
|
||||
len = HTTPD_IOBUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
send(pstate->sockfd, pstate->file.data, pstate->len, 0);
|
||||
pstate->file.data += pstate->len;
|
||||
pstate->file.len -= pstate->len;
|
||||
send(pstate->ht_sockfd, pstate->ht_file.data, len, 0);
|
||||
pstate->ht_file.data += len;
|
||||
pstate->ht_file.len -= len;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int send_headers(struct httpd_state *pstate, const char *statushdr)
|
||||
static int httpd_addchunk(struct httpd_state *pstate, const char *buffer, int len)
|
||||
{
|
||||
int newlen;
|
||||
int chunklen;
|
||||
int ret;
|
||||
|
||||
do
|
||||
{
|
||||
/* Determine the size of the next chunk so that it fits into the buffer */
|
||||
|
||||
newlen = pstate->ht_sndlen + len;
|
||||
if (newlen > HTTPD_IOBUFFER_SIZE)
|
||||
{
|
||||
newlen = HTTPD_IOBUFFER_SIZE;
|
||||
chunklen = HTTPD_IOBUFFER_SIZE - pstate->ht_sndlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
chunklen = len;
|
||||
}
|
||||
vdbg("[%d] sndlen=%d len=%d newlen=%d chunklen=%d\n",
|
||||
pstate->ht_sockfd, pstate->ht_sndlen, len, newlen, chunklen);
|
||||
|
||||
/* Copy that chunk into the send buffer */
|
||||
|
||||
memcpy(&pstate->ht_buffer[pstate->ht_sndlen], buffer, chunklen);
|
||||
|
||||
if (newlen >= HTTPD_IOBUFFER_SIZE)
|
||||
{
|
||||
/* The buffer is full.. Send what we have and reset to send again */
|
||||
|
||||
httpd_dumpbuffer(pstate->ht_buffer, newlen);
|
||||
ret = send(pstate->ht_sockfd, pstate->ht_buffer, newlen, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
newlen = 0;
|
||||
}
|
||||
|
||||
pstate->ht_sndlen = newlen;
|
||||
len -= chunklen;
|
||||
buffer += chunklen;
|
||||
}
|
||||
while (len > 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int send_headers(struct httpd_state *pstate, const char *statushdr, int len)
|
||||
{
|
||||
char *ptr;
|
||||
int ret;
|
||||
|
||||
ret = send(pstate->sockfd, statushdr, strlen(statushdr), 0);
|
||||
ret = httpd_addchunk(pstate, statushdr, len);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ptr = strrchr(pstate->filename, ISO_period);
|
||||
ptr = strrchr(pstate->ht_filename, ISO_period);
|
||||
if (ptr == NULL)
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_binary, strlen(http_content_type_binary), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypebinary, strlen(g_httpcontenttypebinary));
|
||||
}
|
||||
else if (strncmp(http_html, ptr, 5) == 0 || strncmp(http_shtml, ptr, 6) == 0)
|
||||
else if (strncmp(g_httpextensionhtml, ptr, strlen(g_httpextensionhtml)) == 0 ||
|
||||
strncmp(g_httpextensionshtml, ptr, strlen(g_httpextensionshtml)) == 0)
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_html, strlen(http_content_type_html), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypehtml, strlen(g_httpcontenttypehtml));
|
||||
}
|
||||
else if (strncmp(http_css, ptr, 4) == 0)
|
||||
else if (strncmp(g_httpextensioncss, ptr, strlen(g_httpextensioncss)) == 0)
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_css, strlen(http_content_type_css), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypecss, strlen(g_httpcontenttypecss));
|
||||
}
|
||||
else if (strncmp(http_png, ptr, 4) == 0)
|
||||
else if (strncmp(g_httpextensionpng, ptr, strlen(g_httpextensionpng)) == 0)
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_png, strlen(http_content_type_png), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypepng, strlen(g_httpcontenttypepng));
|
||||
}
|
||||
else if (strncmp(http_gif, ptr, 4) == 0)
|
||||
else if (strncmp(g_httpextensiongif, ptr, strlen(g_httpextensiongif)) == 0)
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_gif, strlen(http_content_type_gif), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypegif, strlen(g_httpcontenttypegif));
|
||||
}
|
||||
else if (strncmp(http_jpg, ptr, 4) == 0)
|
||||
else if (strncmp(g_httpextensionjpg, ptr, strlen(g_httpextensionjpg)) == 0)
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_jpg, strlen(http_content_type_jpg), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypejpg, strlen(g_httpcontenttypejpg));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = send(pstate->sockfd, http_content_type_plain, strlen(http_content_type_plain), 0);
|
||||
ret = httpd_addchunk(pstate, g_httpcontenttypeplain, strlen(g_httpcontenttypeplain));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void httpd_sendfile(struct httpd_state *pstate)
|
||||
static int httpd_sendfile(struct httpd_state *pstate)
|
||||
{
|
||||
char *ptr;
|
||||
int ret = ERROR;
|
||||
|
||||
if (!httpd_fs_open(pstate->filename, &pstate->file))
|
||||
pstate->ht_sndlen = 0;
|
||||
|
||||
if (!httpd_fs_open(pstate->ht_filename, &pstate->ht_file))
|
||||
{
|
||||
httpd_fs_open(http_404_html, &pstate->file);
|
||||
strcpy(pstate->filename, http_404_html);
|
||||
send_headers(pstate, http_header_404);
|
||||
send(pstate->sockfd, pstate->file.data, pstate->file.len, 0);
|
||||
memcpy(pstate->ht_filename, g_http404path, strlen(g_http404path));
|
||||
httpd_fs_open(g_http404path, &pstate->ht_file);
|
||||
if (send_headers(pstate, g_httpheader404, strlen(g_httpheader404)) == OK)
|
||||
{
|
||||
ret = httpd_addchunk(pstate, pstate->ht_file.data, pstate->ht_file.len);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
send_headers(pstate, http_header_200);
|
||||
ptr = strchr(pstate->filename, ISO_period);
|
||||
if (ptr != NULL && strncmp(ptr, http_shtml, 6) == 0)
|
||||
if (send_headers(pstate, g_httpheader200, strlen(g_httpheader200)) == OK)
|
||||
{
|
||||
handle_script(pstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
send(pstate->sockfd, pstate->file.data, pstate->file.len, 0);
|
||||
ptr = strchr(pstate->ht_filename, ISO_period);
|
||||
if (ptr != NULL &&
|
||||
strncmp(ptr, g_httpextensionshtml, strlen(g_httpextensionshtml)) == 0)
|
||||
{
|
||||
ret = handle_script(pstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = httpd_addchunk(pstate, pstate->ht_file.data, pstate->ht_file.len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Send anything remaining in the buffer */
|
||||
|
||||
if (ret == OK && pstate->ht_sndlen > 0)
|
||||
{
|
||||
httpd_dumpbuffer(pstate->ht_buffer, pstate->ht_sndlen);
|
||||
if (send(pstate->ht_sockfd, pstate->ht_buffer, pstate->ht_sndlen, 0) < 0)
|
||||
{
|
||||
ret = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int httpd_cmd(struct httpd_state *pstate)
|
||||
@@ -273,19 +402,19 @@ static inline int httpd_cmd(struct httpd_state *pstate)
|
||||
|
||||
/* Get the next HTTP command. We will handle only GET */
|
||||
|
||||
recvlen = recv(pstate->sockfd, pstate->ht_buffer, HTTPD_IOBUFFER_SIZE, 0);
|
||||
recvlen = recv(pstate->ht_sockfd, pstate->ht_buffer, HTTPD_IOBUFFER_SIZE, 0);
|
||||
if (recvlen < 0)
|
||||
{
|
||||
dbg("recv failed: %d\n", errno);
|
||||
dbg("[%d] recv failed: %d\n", pstate->ht_sockfd, errno);
|
||||
return ERROR;
|
||||
}
|
||||
httpd_dumpbuffer(pstate, recvlen);
|
||||
httpd_dumpbuffer(pstate->ht_buffer, recvlen);
|
||||
|
||||
/* We will handle only GET */
|
||||
|
||||
if (strncmp(pstate->ht_buffer, http_get, 4) != 0)
|
||||
if (strncmp(pstate->ht_buffer, g_httpcmdget, strlen(g_httpcmdget)) != 0)
|
||||
{
|
||||
dbg("Unsupported command\n");
|
||||
dbg("[%d] Unsupported command\n", pstate->ht_sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@@ -293,25 +422,28 @@ static inline int httpd_cmd(struct httpd_state *pstate)
|
||||
|
||||
if (pstate->ht_buffer[4] != ISO_slash)
|
||||
{
|
||||
dbg("Missing path\n");
|
||||
dbg("[%d] Missing path\n", pstate->ht_sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
else if (pstate->ht_buffer[5] == ISO_space)
|
||||
{
|
||||
strncpy(pstate->filename, http_index_html, sizeof(pstate->filename));
|
||||
strncpy(pstate->ht_filename, g_httpindexpath, strlen(g_httpindexpath));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 5; i < sizeof(pstate->filename) + 5 && pstate->ht_buffer[5] != ISO_space; i++)
|
||||
for (i = 0;
|
||||
i < (HTTPD_MAX_FILENAME-1) && pstate->ht_buffer[i+5] != ISO_space;
|
||||
i++)
|
||||
{
|
||||
pstate->filename[i] = pstate->ht_buffer[i+5];
|
||||
pstate->ht_filename[i] = pstate->ht_buffer[i+5];
|
||||
}
|
||||
pstate->ht_filename[i]='\0';
|
||||
}
|
||||
dbg("[%d] Filename: %s\n", pstate->ht_sockfd, pstate->ht_filename);
|
||||
|
||||
/* Then send the file */
|
||||
|
||||
httpd_sendfile(pstate);
|
||||
return OK;
|
||||
return httpd_sendfile(pstate);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -330,7 +462,7 @@ static void *httpd_handler(void *arg)
|
||||
int sockfd = (int)arg;
|
||||
int ret = ERROR;
|
||||
|
||||
dbg("Started, sd=%d\n", sockfd);
|
||||
dbg("[%d] Started\n", sockfd);
|
||||
|
||||
/* Verify that the state structure was successfully allocated */
|
||||
|
||||
@@ -342,7 +474,7 @@ static void *httpd_handler(void *arg)
|
||||
/* Re-initialize the thread state structure */
|
||||
|
||||
memset(pstate, 0, sizeof(struct httpd_state));
|
||||
pstate->sockfd = sockfd;
|
||||
pstate->ht_sockfd = sockfd;
|
||||
|
||||
/* Then handle the next httpd command */
|
||||
|
||||
@@ -350,14 +482,14 @@ static void *httpd_handler(void *arg)
|
||||
}
|
||||
while (ret == OK);
|
||||
|
||||
/* End of command processing -- Clean up and exit */
|
||||
/* End of command processing -- Clean up and exit */
|
||||
|
||||
free(pstate);
|
||||
}
|
||||
free(pstate);
|
||||
}
|
||||
|
||||
/* Exit the task */
|
||||
|
||||
dbg("Exitting\n");
|
||||
dbg("[%d] Exitting\n", sockfd);
|
||||
close(sockfd);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
@@ -46,13 +46,16 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <net/uip/uip.h>
|
||||
#include <net/uip/uipopt.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define HTTPD_FS_STATISTICS 1
|
||||
#define HTTPD_IOBUFFER_SIZE 512
|
||||
#define HTTPD_IOBUFFER_SIZE UIP_TCP_MSS
|
||||
#define HTTPD_MAX_FILENAME 20
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_UIP_HTTPDSTACKSIZE
|
||||
# define CONFIG_EXAMPLES_UIP_HTTPDSTACKSIZE 4096
|
||||
@@ -70,15 +73,13 @@ struct httpd_fs_file
|
||||
|
||||
struct httpd_state
|
||||
{
|
||||
char ht_buffer[HTTPD_IOBUFFER_SIZE];
|
||||
char filename[20];
|
||||
struct httpd_fs_file file;
|
||||
int sockfd; /* The socket descriptor from accept() */
|
||||
int len;
|
||||
char *scriptptr;
|
||||
int scriptlen;
|
||||
|
||||
unsigned short count;
|
||||
char ht_buffer[HTTPD_IOBUFFER_SIZE]; /* recv()/send() buffer */
|
||||
char ht_filename[HTTPD_MAX_FILENAME]; /* filename from GET command */
|
||||
struct httpd_fs_file ht_file; /* Fake file data to send */
|
||||
int ht_sockfd; /* The socket descriptor from accept() */
|
||||
char *ht_scriptptr;
|
||||
uint16 ht_scriptlen;
|
||||
uint16 ht_sndlen;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -77,7 +77,9 @@
|
||||
|
||||
int sched_setupidlefiles(FAR _TCB *tcb)
|
||||
{
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_DEV_CONSOLE)
|
||||
int fd;
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
/* Allocate file descriptors for the TCB */
|
||||
|
||||
Reference in New Issue
Block a user