2007-08-27 01:12:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* uipopt.h
|
|
|
|
* Configuration options for uIP.
|
|
|
|
*
|
|
|
|
* This file is used for tweaking various configuration options for
|
|
|
|
* uIP. You should make a copy of this file into one of your project's
|
|
|
|
* directories instead of editing this example "uipopt.h" file that
|
|
|
|
* comes with the uIP distribution.
|
|
|
|
*
|
|
|
|
* uIP is configured using the per-project configuration file
|
|
|
|
* uipopt.h. This file contains all compile-time options for uIP and
|
|
|
|
* should be tweaked to match each specific project. The uIP
|
|
|
|
* distribution contains a documented example "uipopt.h" that can be
|
|
|
|
* copied and modified for each project.
|
|
|
|
*
|
|
|
|
* Note: Most of the configuration options in the uipopt.h should not
|
|
|
|
* be changed, but rather the per-project defconfig file.
|
|
|
|
*
|
2011-03-12 16:36:28 +01:00
|
|
|
* Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
|
2007-09-01 20:06:15 +02:00
|
|
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
|
|
|
*
|
|
|
|
* This logic was leveraged from uIP which also has a BSD-style license:
|
|
|
|
*
|
|
|
|
* Author: Adam Dunkels <adam@dunkels.com>
|
|
|
|
* Copyright (c) 2001-2003, Adam Dunkels.
|
|
|
|
* All rights reserved.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* 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. The name of the author may not be used to endorse or promote
|
|
|
|
* products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
|
|
|
*
|
2007-09-01 20:06:15 +02:00
|
|
|
****************************************************************************/
|
2007-08-27 01:12:17 +02:00
|
|
|
|
|
|
|
#ifndef __UIPOPT_H__
|
|
|
|
#define __UIPOPT_H__
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2009-12-14 16:46:55 +01:00
|
|
|
#include <stdint.h>
|
2007-08-27 01:12:17 +02:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2011-03-12 16:36:28 +01:00
|
|
|
/* Layer 2 Configuration Options ********************************************/
|
|
|
|
|
|
|
|
/* The default data link layer for uIP is Ethernet. If CONFIG_NET_SLIP is
|
|
|
|
* defined in the NuttX header file, then SLIP will be supported. The basic
|
|
|
|
* differences between the SLIP and Ethernet configurations is that when SLIP
|
|
|
|
* is selected:
|
|
|
|
*
|
|
|
|
* - The link level header (that comes before the IP header) is omitted.
|
|
|
|
* - All MAC address processing is suppressed.
|
|
|
|
* - ARP is disabled.
|
|
|
|
*
|
|
|
|
* If CONFIG_NET_SLIP is not supported, then Ethernet will be used (there is
|
|
|
|
* no need to define anything special in the configuration file to use
|
|
|
|
* Ethernet -- it is the default).
|
|
|
|
*
|
|
|
|
* The "link level header" is the offset into the d_buf where the IP header
|
|
|
|
* can be found. For Ethernet, this should be set to 14. For SLIP, this
|
|
|
|
* should be set to 0.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#undef CONFIG_NET_ETHERNET
|
|
|
|
#undef CONFIG_NET_ARP
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_SLIP
|
|
|
|
# ifdef CONFIG_NET_IPv6
|
|
|
|
# error "SLIP is not implemented for IPv6"
|
|
|
|
# endif
|
|
|
|
# define UIP_LLH_LEN 0
|
|
|
|
#else
|
|
|
|
# define CONFIG_NET_ETHERNET 1
|
|
|
|
# define CONFIG_NET_ARP 1
|
|
|
|
# define UIP_LLH_LEN 14
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Layer 3/4 Configuration Options ******************************************/
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* IP configuration options */
|
|
|
|
|
|
|
|
/* The IP TTL (time to live) of IP packets sent by uIP.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* This should normally not be changed.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#define UIP_TTL 64
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* Turn on support for IP packet reassembly.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* uIP supports reassembly of fragmented IP packets. This features
|
|
|
|
* requires an additonal amount of RAM to hold the reassembly buffer
|
|
|
|
* and the reassembly code size is approximately 700 bytes. The
|
2007-09-16 00:45:45 +02:00
|
|
|
* reassembly buffer is of the same size as the d_buf buffer
|
2007-11-20 00:09:39 +01:00
|
|
|
* (configured by CONFIG_NET_BUFSIZE).
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
2007-09-01 20:06:15 +02:00
|
|
|
* Note: IP packet reassembly is not heavily tested.
|
2007-08-27 01:12:17 +02:00
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-08-27 01:12:17 +02:00
|
|
|
#define UIP_REASSEMBLY 0
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The maximum time an IP fragment should wait in the reassembly
|
2007-11-07 23:54:51 +01:00
|
|
|
* buffer before it is dropped. Units are deci-seconds, the range
|
|
|
|
* of the timer is 8-bits.
|
2007-08-27 01:12:17 +02:00
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-07 23:54:51 +01:00
|
|
|
#define UIP_REASS_MAXAGE (20*10) /* 20 seconds */
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2011-06-06 17:06:08 +02:00
|
|
|
/* Network drivers often receive packets with garbage at the end
|
|
|
|
* and are longer than the size of packet in the TCP header. The
|
|
|
|
* following "fudge" factor increases the size of the I/O buffering
|
|
|
|
* by a small amount to allocate slightly oversize packets. After
|
|
|
|
* receipt, the packet size will be chopped down to the size indicated
|
|
|
|
* in the TCP header.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONFIG_NET_GUARDSIZE
|
|
|
|
# define CONFIG_NET_GUARDSIZE 2
|
|
|
|
#endif
|
|
|
|
|
2008-09-02 22:42:01 +02:00
|
|
|
/* ICMP configuration options */
|
|
|
|
|
|
|
|
#if !defined(CONFIG_NET_ICMP) || defined(CONFIG_DISABLE_CLOCK)
|
|
|
|
# undef CONFIG_NET_ICMP_PING
|
|
|
|
#endif
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* UDP configuration options */
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
/* The maximum amount of concurrent UDP connection, Default: 10 */
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#ifndef CONFIG_NET_UDP_CONNS
|
2008-09-01 15:59:54 +02:00
|
|
|
# ifdef CONFIG_NET_UDP
|
|
|
|
# define CONFIG_NET_UDP_CONNS 10
|
|
|
|
# else
|
|
|
|
# define CONFIG_NET_UDP_CONNS 0
|
|
|
|
# endif
|
2007-08-27 01:12:17 +02:00
|
|
|
#endif
|
|
|
|
|
2008-09-06 00:47:42 +02:00
|
|
|
/* The UDP maximum packet size. This is should not be to set to more
|
|
|
|
* than CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_IPUDPH_LEN.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define UIP_UDP_MSS (CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_IPUDPH_LEN)
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* TCP configuration options */
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The maximum number of simultaneously open TCP connections.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* Since the TCP connections are statically allocated, turning this
|
|
|
|
* configuration knob down results in less RAM used. Each TCP
|
|
|
|
* connection requires approximatly 30 bytes of memory.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#ifndef CONFIG_NET_TCP_CONNS
|
2008-09-01 15:59:54 +02:00
|
|
|
# ifdef CONFIG_NET_TCP
|
|
|
|
# define CONFIG_NET_TCP_CONNS 10
|
|
|
|
# else
|
|
|
|
# define CONFIG_NET_TCP_CONNS 0
|
|
|
|
# endif
|
2007-11-20 00:09:39 +01:00
|
|
|
#endif
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The maximum number of simultaneously listening TCP ports.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* Each listening TCP port requires 2 bytes of memory.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_NET_MAX_LISTENPORTS
|
2007-11-20 00:09:39 +01:00
|
|
|
# define CONFIG_NET_MAX_LISTENPORTS 20
|
|
|
|
#endif
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2008-09-01 15:59:54 +02:00
|
|
|
/* Define the maximum number of concurrently active UDP and TCP
|
|
|
|
* ports. This number must be greater than the number of open
|
|
|
|
* sockets in order to support multi-threaded read/write operations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONFIG_NET_NACTIVESOCKETS
|
|
|
|
# define CONFIG_NET_NACTIVESOCKETS (CONFIG_NET_TCP_CONNS + CONFIG_NET_UDP_CONNS)
|
|
|
|
#endif
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The initial retransmission timeout counted in timer pulses.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* This should not be changed.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#define UIP_RTO 3
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The maximum number of times a segment should be retransmitted
|
2007-08-27 01:12:17 +02:00
|
|
|
* before the connection should be aborted.
|
|
|
|
*
|
|
|
|
* This should not be changed.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#define UIP_MAXRTX 8
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The maximum number of times a SYN segment should be retransmitted
|
2007-08-27 01:12:17 +02:00
|
|
|
* before a connection request should be deemed to have been
|
|
|
|
* unsuccessful.
|
|
|
|
*
|
|
|
|
* This should not need to be changed.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#define UIP_MAXSYNRTX 5
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2008-12-12 03:17:15 +01:00
|
|
|
/* The TCP maximum segment size. This is should not be set to more
|
2008-09-06 00:47:42 +02:00
|
|
|
* than CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
|
2007-08-27 01:12:17 +02:00
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#define UIP_TCP_MSS (CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The size of the advertised receiver's window.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
2007-09-16 00:45:45 +02:00
|
|
|
* Should be set low (i.e., to the size of the d_buf buffer) is the
|
2007-08-27 01:12:17 +02:00
|
|
|
* application is slow to process incoming data, or high (32768 bytes)
|
|
|
|
* if the application processes data quickly.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_NET_RECEIVE_WINDOW
|
2007-11-20 00:09:39 +01:00
|
|
|
# define CONFIG_NET_RECEIVE_WINDOW UIP_TCP_MSS
|
2007-08-27 01:12:17 +02:00
|
|
|
#endif
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* How long a connection should stay in the TIME_WAIT state.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* This configiration option has no real implication, and it should be
|
2007-11-07 23:54:51 +01:00
|
|
|
* left untouched. Units: half second.
|
2007-08-27 01:12:17 +02:00
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-07 23:54:51 +01:00
|
|
|
#define UIP_TIME_WAIT_TIMEOUT (60*2)
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* ARP configuration options */
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The size of the ARP table.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* This option should be set to a larger value if this uIP node will
|
|
|
|
* have many connections from the local network.
|
|
|
|
*/
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#ifndef CONFIG_NET_ARPTAB_SIZE
|
|
|
|
# define CONFIG_NET_ARPTAB_SIZE 8
|
2007-08-27 01:12:17 +02:00
|
|
|
#endif
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The maxium age of ARP table entries measured in 10ths of seconds.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
|
|
|
|
* default).
|
|
|
|
*/
|
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
#define UIP_ARP_MAXAGE 120
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* General configuration options */
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/* The size of the uIP packet buffer.
|
2007-08-27 01:12:17 +02:00
|
|
|
*
|
|
|
|
* The uIP packet buffer should not be smaller than 60 bytes, and does
|
|
|
|
* not need to be larger than 1500 bytes. Lower size results in lower
|
|
|
|
* TCP throughput, larger size results in higher TCP throughput.
|
|
|
|
*/
|
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
#ifndef CONFIG_NET_BUFSIZE
|
|
|
|
# define CONFIG_NET_BUFSIZE 400
|
|
|
|
#endif
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
/* Number of TCP read-ahead buffers (may be zero) */
|
|
|
|
|
|
|
|
#ifndef CONFIG_NET_NTCP_READAHEAD_BUFFERS
|
|
|
|
# define CONFIG_NET_NTCP_READAHEAD_BUFFERS 4
|
|
|
|
#endif
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-11-20 00:09:39 +01:00
|
|
|
/* The size of the TCP read buffer size */
|
|
|
|
|
|
|
|
#ifndef CONFIG_NET_TCP_READAHEAD_BUFSIZE
|
|
|
|
# define CONFIG_NET_TCP_READAHEAD_BUFSIZE UIP_TCP_MSS
|
|
|
|
#endif
|
2007-08-27 01:12:17 +02:00
|
|
|
|
2007-09-01 20:06:15 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Statistics datatype
|
|
|
|
*
|
|
|
|
* This typedef defines the dataype used for keeping statistics in
|
|
|
|
* uIP.
|
|
|
|
*/
|
|
|
|
|
2009-12-14 16:46:55 +01:00
|
|
|
typedef uint16_t uip_stats_t;
|
2007-09-01 20:06:15 +02:00
|
|
|
|
2007-08-27 01:12:17 +02:00
|
|
|
#endif /* __UIPOPT_H__ */
|