diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index f928eb02e..c880ef3e2 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -576,4 +576,7 @@ and not recv() is in-place when a TCP/IP packet is received, the packet is placed into a read-ahead buffer. However, the old contents of the read-ahead buffer were not being cleared and old data would contaminate the newly received buffer. + * Implemented support for connection backlog. The size of the backlog is specified by the + second argument of the standard listen() API. Hooks are provided to support poll()/select() + waiting for connections, with a subsequent call to accept() to use the backlogged connection. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 39ba8dcc3..3dd0d53fa 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@
Last Updated: November 17, 2008
+Last Updated: November 20, 2008
make
.
CONFIG_NET_TCP_CONNS
: Maximum number of TCP connections (all tasks).
CONFIG_NET_TCPBACKLOG
:
+ Incoming connections pend in a backlog until accept()
is called.
+ The size of the backlog is selected when listen()
is called.
+ CONFIG_NET_TCP_READAHEAD_BUFSIZE
: Size of TCP read-ahead buffers
CONFIG_NSOCKET_DESCRIPTORS
Defined to be greater than 0CONFIG_NET_NTCP_READAHEAD_BUFFERS
Defined to be greater than zero+ In order to for select to work with incoming connections, you must also select: +
+CONFIG_NET_TCPBACKLOG
+ Incoming connections pend in a backlog until accept() is called.
+ The size of the backlog is selected when listen()
is called.
Input Parameters:
diff --git a/nuttx/TODO b/nuttx/TODO index 4d31d9dbd..e90e10e9c 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated November 17, 2008) +NuttX TODO List (Last updated November 19, 2008) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (7) Task/Scheduler (sched/) @@ -7,7 +7,7 @@ NuttX TODO List (Last updated November 17, 2008) (1) Signals (sched/, arch/) (1) pthreads (sched/) (1) C++ Support - (14) Network (net/, netutils/) + (15) Network (net/, netutils/) (1) USB (drivers/usbdev) (4) Libraries (lib/) (6) File system/Generic drivers (fs/, drivers/) diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 750d945a9..176cbbe6f 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -287,6 +287,9 @@ defconfig -- This is a configuration file similar to the Linux 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_TCPBACKLOG - Incoming connections pend in a backlog until + accept() is called. The size of the backlog is selected when listen() + is called. 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 diff --git a/nuttx/configs/c5471evm/defconfig b/nuttx/configs/c5471evm/defconfig index 5b5c70ed3..e388541aa 100644 --- a/nuttx/configs/c5471evm/defconfig +++ b/nuttx/configs/c5471evm/defconfig @@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=n CONFIG_NET_TCP_CONNS=40 CONFIG_NET_NTCP_READAHEAD_BUFFERS=8 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=40 CONFIG_NET_UDP=n CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/c5471evm/dhcpconfig b/nuttx/configs/c5471evm/dhcpconfig index 7a44e126c..8359dd6c9 100644 --- a/nuttx/configs/c5471evm/dhcpconfig +++ b/nuttx/configs/c5471evm/dhcpconfig @@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=n CONFIG_NET_TCP_CONNS=0 CONFIG_NET_NTCP_READAHEAD_BUFFERS=0 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=0 CONFIG_NET_UDP=y CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/c5471evm/netconfig b/nuttx/configs/c5471evm/netconfig index 135f87ec9..61c3176f7 100644 --- a/nuttx/configs/c5471evm/netconfig +++ b/nuttx/configs/c5471evm/netconfig @@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 CONFIG_NET_NTCP_READAHEAD_BUFFERS=32 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_UDP=n CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/c5471evm/nshconfig b/nuttx/configs/c5471evm/nshconfig index 39a3b1121..c6566fe0f 100644 --- a/nuttx/configs/c5471evm/nshconfig +++ b/nuttx/configs/c5471evm/nshconfig @@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 CONFIG_NET_NTCP_READAHEAD_BUFFERS=32 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_UDP=n CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig index 117495ba3..12b9efb78 100644 --- a/nuttx/configs/ez80f910200kitg/ostest/defconfig +++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig @@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/m68332evb/defconfig b/nuttx/configs/m68332evb/defconfig index 12af3888a..2e668f2bb 100644 --- a/nuttx/configs/m68332evb/defconfig +++ b/nuttx/configs/m68332evb/defconfig @@ -263,6 +263,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/mcu123-lpc214x/nsh/defconfig b/nuttx/configs/mcu123-lpc214x/nsh/defconfig index 9f6d9edd7..f7ea9ae7b 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/defconfig +++ b/nuttx/configs/mcu123-lpc214x/nsh/defconfig @@ -316,6 +316,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/mcu123-lpc214x/ostest/defconfig b/nuttx/configs/mcu123-lpc214x/ostest/defconfig index be623258c..83824dd65 100644 --- a/nuttx/configs/mcu123-lpc214x/ostest/defconfig +++ b/nuttx/configs/mcu123-lpc214x/ostest/defconfig @@ -311,6 +311,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig index 63cabf7c4..cd318b422 100644 --- a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig +++ b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig @@ -312,6 +312,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig index aeaa2e914..294e3fc8f 100644 --- a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig +++ b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig @@ -312,6 +312,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/ntosd-dm320/nettest/defconfig b/nuttx/configs/ntosd-dm320/nettest/defconfig index f25b9ac8b..eea5c03c6 100644 --- a/nuttx/configs/ntosd-dm320/nettest/defconfig +++ b/nuttx/configs/ntosd-dm320/nettest/defconfig @@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -297,6 +299,8 @@ CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_UDP=n CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/ntosd-dm320/nsh/defconfig b/nuttx/configs/ntosd-dm320/nsh/defconfig index e1b318dd4..1134b7204 100644 --- a/nuttx/configs/ntosd-dm320/nsh/defconfig +++ b/nuttx/configs/ntosd-dm320/nsh/defconfig @@ -285,6 +285,8 @@ CONFIG_FS_ROMFS=y # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -305,6 +307,8 @@ CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFSIZE=562 CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_UDP=y CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/ntosd-dm320/ostest/defconfig b/nuttx/configs/ntosd-dm320/ostest/defconfig index c4f70d85f..96dfa7127 100644 --- a/nuttx/configs/ntosd-dm320/ostest/defconfig +++ b/nuttx/configs/ntosd-dm320/ostest/defconfig @@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/ntosd-dm320/poll/defconfig b/nuttx/configs/ntosd-dm320/poll/defconfig index c7dd78daf..f88a6b951 100644 --- a/nuttx/configs/ntosd-dm320/poll/defconfig +++ b/nuttx/configs/ntosd-dm320/poll/defconfig @@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -297,7 +299,8 @@ CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 -CONFIG_NET_TCP_READAHEAD_BUFSIZE=16 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCPBACKLOG=y CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_UDP=n CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/ntosd-dm320/udp/defconfig b/nuttx/configs/ntosd-dm320/udp/defconfig index f2562d2ee..8237ac4b3 100644 --- a/nuttx/configs/ntosd-dm320/udp/defconfig +++ b/nuttx/configs/ntosd-dm320/udp/defconfig @@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -297,6 +299,8 @@ CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=n CONFIG_NET_TCP_CONNS=0 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=0 CONFIG_NET_UDP=y CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/ntosd-dm320/uip/defconfig b/nuttx/configs/ntosd-dm320/uip/defconfig index 3219b4e86..190d5f185 100644 --- a/nuttx/configs/ntosd-dm320/uip/defconfig +++ b/nuttx/configs/ntosd-dm320/uip/defconfig @@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off @@ -297,6 +299,8 @@ CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFSIZE=420 CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCPBACKLOG=n CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_UDP=n CONFIG_NET_UDP_CHECKSUMS=y diff --git a/nuttx/configs/olimex-strp711/ostest/defconfig b/nuttx/configs/olimex-strp711/ostest/defconfig index 1632dbb08..17f0d90a4 100644 --- a/nuttx/configs/olimex-strp711/ostest/defconfig +++ b/nuttx/configs/olimex-strp711/ostest/defconfig @@ -378,6 +378,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/pjrc-8051/defconfig b/nuttx/configs/pjrc-8051/defconfig index 934e255a8..68cf619c0 100644 --- a/nuttx/configs/pjrc-8051/defconfig +++ b/nuttx/configs/pjrc-8051/defconfig @@ -260,6 +260,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/sim/mount/defconfig b/nuttx/configs/sim/mount/defconfig index 2c39b55a9..ff24f5bff 100644 --- a/nuttx/configs/sim/mount/defconfig +++ b/nuttx/configs/sim/mount/defconfig @@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/sim/nettest/defconfig b/nuttx/configs/sim/nettest/defconfig index f211b86cc..65a0a5c48 100644 --- a/nuttx/configs/sim/nettest/defconfig +++ b/nuttx/configs/sim/nettest/defconfig @@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index 3ea4b4e44..f5a0531f9 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=y # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index 4c1249466..4ea688e85 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -236,6 +236,8 @@ CONFIG_FS_ROMFS=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/sim/pashello/defconfig b/nuttx/configs/sim/pashello/defconfig index 164c4ac6b..67dd4688c 100644 --- a/nuttx/configs/sim/pashello/defconfig +++ b/nuttx/configs/sim/pashello/defconfig @@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/us7032evb1/nsh/defconfig b/nuttx/configs/us7032evb1/nsh/defconfig index e4e150b09..b97c94185 100644 --- a/nuttx/configs/us7032evb1/nsh/defconfig +++ b/nuttx/configs/us7032evb1/nsh/defconfig @@ -330,6 +330,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/us7032evb1/ostest/defconfig b/nuttx/configs/us7032evb1/ostest/defconfig index e21df0942..ae3160cb6 100644 --- a/nuttx/configs/us7032evb1/ostest/defconfig +++ b/nuttx/configs/us7032evb1/ostest/defconfig @@ -330,6 +330,8 @@ CONFIG_MMCSD_READONLY=n # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/xtrs/nsh/defconfig b/nuttx/configs/xtrs/nsh/defconfig index d26ff9d06..0938ef807 100644 --- a/nuttx/configs/xtrs/nsh/defconfig +++ b/nuttx/configs/xtrs/nsh/defconfig @@ -256,6 +256,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/xtrs/ostest/defconfig b/nuttx/configs/xtrs/ostest/defconfig index b17d18c23..4ede528f3 100644 --- a/nuttx/configs/xtrs/ostest/defconfig +++ b/nuttx/configs/xtrs/ostest/defconfig @@ -256,6 +256,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/xtrs/pashello/defconfig b/nuttx/configs/xtrs/pashello/defconfig index 7e7e7f986..cca03f9d7 100644 --- a/nuttx/configs/xtrs/pashello/defconfig +++ b/nuttx/configs/xtrs/pashello/defconfig @@ -256,6 +256,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z16f2800100zcog/ostest/defconfig b/nuttx/configs/z16f2800100zcog/ostest/defconfig index 6b3959ec4..a7706199a 100644 --- a/nuttx/configs/z16f2800100zcog/ostest/defconfig +++ b/nuttx/configs/z16f2800100zcog/ostest/defconfig @@ -282,6 +282,8 @@ CONFIG_PREALLOC_TIMERS=4 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z16f2800100zcog/pashello/defconfig b/nuttx/configs/z16f2800100zcog/pashello/defconfig index d1ac37bd3..0ea008a40 100644 --- a/nuttx/configs/z16f2800100zcog/pashello/defconfig +++ b/nuttx/configs/z16f2800100zcog/pashello/defconfig @@ -282,6 +282,8 @@ CONFIG_PREALLOC_TIMERS=4 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z80sim/nsh/defconfig b/nuttx/configs/z80sim/nsh/defconfig index 0589cdc06..14fd9c0c2 100644 --- a/nuttx/configs/z80sim/nsh/defconfig +++ b/nuttx/configs/z80sim/nsh/defconfig @@ -246,6 +246,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z80sim/ostest/defconfig b/nuttx/configs/z80sim/ostest/defconfig index ecf71cb6d..0dc407750 100644 --- a/nuttx/configs/z80sim/ostest/defconfig +++ b/nuttx/configs/z80sim/ostest/defconfig @@ -246,6 +246,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z80sim/pashello/defconfig b/nuttx/configs/z80sim/pashello/defconfig index 4e2e6a6a0..cad124da5 100644 --- a/nuttx/configs/z80sim/pashello/defconfig +++ b/nuttx/configs/z80sim/pashello/defconfig @@ -246,6 +246,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z8encore000zco/ostest/defconfig b/nuttx/configs/z8encore000zco/ostest/defconfig index 4f8a8c4e2..776cecd08 100644 --- a/nuttx/configs/z8encore000zco/ostest/defconfig +++ b/nuttx/configs/z8encore000zco/ostest/defconfig @@ -280,6 +280,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/configs/z8f64200100kit/ostest/defconfig b/nuttx/configs/z8f64200100kit/ostest/defconfig index 444ff59d0..50df6ae07 100644 --- a/nuttx/configs/z8f64200100kit/ostest/defconfig +++ b/nuttx/configs/z8f64200100kit/ostest/defconfig @@ -280,6 +280,8 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) # 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_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. # CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) # CONFIG_NET_UDP - UDP support on or off # CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt index f6528e5f4..f2a597800 100644 --- a/nuttx/examples/README.txt +++ b/nuttx/examples/README.txt @@ -118,6 +118,11 @@ examples/poll CONFIG_EXAMPLE_POLL_DRIPADDR - Default router IP addess CONFIG_EXAMPLE_POLL_NETMASK - Network mask + In order to for select to work with incoming connections, you + must also select: + + CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until accept() is called. + In additional to the target device-side example, there is also a host-side application in this directory. It can be compiled under Linux or Cygwin as follows: diff --git a/nuttx/examples/poll/Makefile b/nuttx/examples/poll/Makefile index b52719912..e91f5018c 100644 --- a/nuttx/examples/poll/Makefile +++ b/nuttx/examples/poll/Makefile @@ -70,6 +70,6 @@ clean: $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + @rm -f Make.dep .depend host -include Make.dep diff --git a/nuttx/examples/poll/poll_main.c b/nuttx/examples/poll/poll_main.c index 713c77e3a..dbf5eec65 100644 --- a/nuttx/examples/poll/poll_main.c +++ b/nuttx/examples/poll/poll_main.c @@ -156,7 +156,7 @@ int user_start(int argc, char *argv[]) } #ifdef HAVE_NETPOLL -#if 0 /* select doesn't work for connections yet */ +#ifdef CONFIG_NET_TCPBACKLOG message("user_start: Starting net_listener thread\n"); ret = pthread_create(&tid3, NULL, net_listener, NULL); diff --git a/nuttx/include/net/uip/uip-tcp.h b/nuttx/include/net/uip/uip-tcp.h index 409081f28..91c5ecbd0 100644 --- a/nuttx/include/net/uip/uip-tcp.h +++ b/nuttx/include/net/uip/uip-tcp.h @@ -77,19 +77,19 @@ /* The TCP states used in the struct uip_conn tcpstateflags field */ -#define UIP_CLOSED 0 /* The connection is not in use and available */ -#define UIP_ALLOCATED 1 /* The connection is allocated, but not yet initialized */ -#define UIP_SYN_RCVD 2 -#define UIP_SYN_SENT 3 -#define UIP_ESTABLISHED 4 -#define UIP_FIN_WAIT_1 5 -#define UIP_FIN_WAIT_2 6 -#define UIP_CLOSING 7 -#define UIP_TIME_WAIT 8 -#define UIP_LAST_ACK 9 - -#define UIP_TS_MASK 15 -#define UIP_STOPPED 16 +#define UIP_TS_MASK 0x0f /* Bits 0-3: TCP state */ +#define UIP_CLOSED 0x00 /* The connection is not in use and available */ +#define UIP_ALLOCATED 0x01 /* The connection is allocated, but not yet initialized */ +#define UIP_SYN_RCVD 0x02 +#define UIP_SYN_SENT 0x03 +#define UIP_ESTABLISHED 0x04 +#define UIP_FIN_WAIT_1 0x05 +#define UIP_FIN_WAIT_2 0x06 +#define UIP_CLOSING 0x07 +#define UIP_TIME_WAIT 0x08 +#define UIP_LAST_ACK 0x09 +#define UIP_STOPPED 0x10 /* Bit 4: stopped */ + /* Bit 5-7: Unused, but not available */ /* Flag bits in 16-bit flags+ipoffset IPv4 TCP header field */ @@ -118,13 +118,11 @@ struct uip_driver_s; /* Forward reference */ struct uip_callback_s; /* Forward reference */ +struct uip_backlog_s; /* Forward reference */ struct uip_conn { dq_entry_t node; /* Implements a doubly linked list */ -#if 0 /* Not used */ - uip_ipaddr_t lipaddr; /* The local IP address */ -#endif uip_ipaddr_t ripaddr; /* The IP address of the remote host */ uint16 lport; /* The local TCP port, in network byte order */ uint16 rport; /* The remoteTCP port, in network byte order */ @@ -146,10 +144,29 @@ struct uip_conn uint8 nrtx; /* The number of retransmissions for the last * segment sent */ - /* Read-ahead buffering */ + /* Read-ahead buffering. + * + * readahead - A singly linked list of type struct uip_readahead_s + * where the TCP/IP read-ahead data is retained. + */ #if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0 - sq_queue_t readahead; + sq_queue_t readahead; /* Read-ahead buffering */ +#endif + + /* Listen backlog support + * + * blparent - The backlog parent. If this connection is backlogged, + * this field will be non-null and will refer to the TCP connection + * structure in which this connection is backlogged. + * backlog - The pending connection backlog. If this connection is + * configured as a listener with backlog, then this refers to the + * struct uip_backlog_s tear-off structure that manages that backlog. + */ + +#ifdef CONFIG_NET_TCPBACKLOG + struct uip_conn *blparent; + struct uip_backlog_s *backlog; #endif /* Application callbacks: @@ -204,6 +221,27 @@ struct uip_readahead_s }; #endif +/* Support for listen backlog: + * + * struct uip_blcontainer_s describes one backlogged connection + * struct uip_backlog_s is a "tear-off" describing all backlog for a + * listener connection + */ + +#ifdef CONFIG_NET_TCPBACKLOG +struct uip_blcontainer_s +{ + dq_entry_t bc_node; /* Implements a doubly linked list */ + FAR struct uip_conn *bc_conn; /* Holds reference to the new connection structure */ +}; + +struct uip_backlog_s +{ + dq_queue_t bl_free; /* Implements a doubly-linked list of free containers */ + dq_queue_t bl_pending; /* Implements a doubly-linked list of pending connections */ +}; +#endif + /* The structure holding the TCP/IP statistics that are gathered if * CONFIG_NET_STATISTICS is defined. */ @@ -350,6 +388,27 @@ extern struct uip_readahead_s *uip_tcpreadaheadalloc(void); extern void uip_tcpreadaheadrelease(struct uip_readahead_s *buf); #endif /* CONFIG_NET_NTCP_READAHEAD_BUFFERS */ +/* Backlog support */ + +#ifdef CONFIG_NET_TCPBACKLOG +/* APIs to create and terminate TCP backlog support */ + +extern int uip_backlogcreate(FAR struct uip_conn *conn, int nblg); +extern int uip_backlogdestroy(FAR struct uip_conn *conn); + +/* APIs to manage individual backlog actions */ + +extern int uip_backlogadd(FAR struct uip_conn *conn, FAR struct uip_conn *blconn); +extern FAR struct uip_conn *uip_backlogremove(FAR struct uip_conn *conn); +extern int uip_backlogdelete(FAR struct uip_conn *conn, FAR struct uip_conn *blconn); + +#else +# define uip_backlogcreate(conn,nblg) (-ENOSYS) +# define uip_backlogdestroy(conn) (-ENOSYS) +# define uip_backlogadd(conn,blconn) (-ENOSYS) +# define uip_backlogremove(conn) (NULL) +#endif + /* Tell the sending host to stop sending data. * * This function will close our receiver's window so that we stop diff --git a/nuttx/include/net/uip/uip.h b/nuttx/include/net/uip/uip.h index 54a94bf98..bc79f64e7 100644 --- a/nuttx/include/net/uip/uip.h +++ b/nuttx/include/net/uip/uip.h @@ -81,7 +81,10 @@ * UIP_POLL IN: Used for polling the application. This is provided * periodically from the drivers to support (1) timed * operations, and (2) to check if the application has -* data that it wants to send + * data that it wants to send + * OUT: Not used + * UIP_BACKLOG IN: There is a new connection in the backlog list set + * up by the listen() command. (TCP only) * OUT: Not used * UIP_CLOSE IN: The remote host has closed the connection, thus the * connection has gone away. (TCP only) @@ -110,11 +113,12 @@ #define UIP_SNDACK (1 << 2) #define UIP_REXMIT (1 << 3) #define UIP_POLL (1 << 4) -#define UIP_CLOSE (1 << 5) -#define UIP_ABORT (1 << 6) -#define UIP_CONNECTED (1 << 7) -#define UIP_TIMEDOUT (1 << 8) -#define UIP_ECHOREPLY (1 << 9) +#define UIP_BACKLOG (1 << 5) +#define UIP_CLOSE (1 << 6) +#define UIP_ABORT (1 << 7) +#define UIP_CONNECTED (1 << 8) +#define UIP_TIMEDOUT (1 << 9) +#define UIP_ECHOREPLY (1 << 10) #define UIP_CONN_EVENTS (UIP_CLOSE|UIP_ABORT|UIP_CONNECTED|UIP_TIMEDOUT) diff --git a/nuttx/net/accept.c b/nuttx/net/accept.c index 122e67c43..3fea60b19 100644 --- a/nuttx/net/accept.c +++ b/nuttx/net/accept.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/accept.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt