Implementation of the NetworkSocketAPI for LWIP

Dependencies:   lwip-eth lwip-sys lwip

Dependents:   HelloLWIPInterface HelloLWIPInterfaceNonBlocking LWIPInterfaceTests SimpleHTTPExample ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lwipopts.h Source File

lwipopts.h

00001 /* Copyright (C) 2012 mbed.org, MIT License
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00004  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00005  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00006  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00007  * furnished to do so, subject to the following conditions:
00008  *
00009  * The above copyright notice and this permission notice shall be included in all copies or
00010  * substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00013  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00014  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00015  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00016  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017  */
00018 
00019 #ifndef LWIPOPTS_H
00020 #define LWIPOPTS_H
00021 
00022 #include "lwipopts_conf.h"
00023 
00024 // Workaround for Linux timeval
00025 #if defined (TOOLCHAIN_GCC)
00026 #define LWIP_TIMEVAL_PRIVATE 0
00027 #include <sys/time.h>
00028 #endif
00029 
00030 // Operating System 
00031 #define NO_SYS                      0
00032 
00033 #if NO_SYS == 0
00034 #include "cmsis_os.h"
00035 
00036 #define SYS_LIGHTWEIGHT_PROT        1
00037 
00038 #define LWIP_RAW                    0
00039 
00040 #define TCPIP_MBOX_SIZE             8
00041 #define DEFAULT_TCP_RECVMBOX_SIZE   8
00042 #define DEFAULT_UDP_RECVMBOX_SIZE   8
00043 #define DEFAULT_RAW_RECVMBOX_SIZE   8
00044 #define DEFAULT_ACCEPTMBOX_SIZE     8
00045 
00046 #define TCPIP_THREAD_STACKSIZE      1024
00047 #define TCPIP_THREAD_PRIO           (osPriorityNormal)
00048 
00049 #define DEFAULT_THREAD_STACKSIZE    512
00050 
00051 #define MEMP_NUM_SYS_TIMEOUT        16
00052 #endif
00053 
00054 // 32-bit alignment
00055 #define MEM_ALIGNMENT               4
00056 
00057 #define PBUF_POOL_SIZE              5
00058 #define MEMP_NUM_TCP_PCB_LISTEN     4
00059 #define MEMP_NUM_TCP_PCB            4
00060 #define MEMP_NUM_UDP_PCB            4
00061 #define MEMP_NUM_PBUF               8
00062 #define MEMP_NUM_NETBUF             8
00063 
00064 #define TCP_QUEUE_OOSEQ             0
00065 #define TCP_OVERSIZE                0
00066 
00067 #define LWIP_DHCP                   1
00068 #define LWIP_DNS                    1
00069 
00070 // Support Multicast
00071 #include "stdlib.h"
00072 #define LWIP_IGMP                   1
00073 #define LWIP_RAND()                 rand()
00074 
00075 #define LWIP_COMPAT_SOCKETS         0
00076 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
00077 #define LWIP_SO_RCVTIMEO            1
00078 #define LWIP_TCP_KEEPALIVE          1
00079 
00080 // Debug Options
00081 // #define LWIP_DEBUG
00082 #define UDP_LPC_EMAC                LWIP_DBG_OFF
00083 #define SYS_DEBUG                   LWIP_DBG_OFF
00084 #define PPP_DEBUG                   LWIP_DBG_OFF
00085 #define IP_DEBUG                    LWIP_DBG_OFF
00086 #define MEM_DEBUG                   LWIP_DBG_OFF
00087 #define MEMP_DEBUG                  LWIP_DBG_OFF
00088 #define PBUF_DEBUG                  LWIP_DBG_OFF
00089 #define API_LIB_DEBUG               LWIP_DBG_OFF
00090 #define API_MSG_DEBUG               LWIP_DBG_OFF
00091 #define TCPIP_DEBUG                 LWIP_DBG_OFF
00092 #define SOCKETS_DEBUG               LWIP_DBG_OFF
00093 #define TCP_DEBUG                   LWIP_DBG_OFF
00094 #define TCP_INPUT_DEBUG             LWIP_DBG_OFF
00095 #define TCP_FR_DEBUG                LWIP_DBG_OFF
00096 #define TCP_RTO_DEBUG               LWIP_DBG_OFF
00097 #define TCP_CWND_DEBUG              LWIP_DBG_OFF
00098 #define TCP_WND_DEBUG               LWIP_DBG_OFF
00099 #define TCP_OUTPUT_DEBUG            LWIP_DBG_OFF
00100 #define TCP_RST_DEBUG               LWIP_DBG_OFF
00101 #define TCP_QLEN_DEBUG              LWIP_DBG_OFF
00102 #define ETHARP_DEBUG                LWIP_DBG_OFF
00103 #define NETIF_DEBUG                 LWIP_DBG_OFF
00104 #define DHCP_DEBUG                  LWIP_DBG_OFF
00105 
00106 #ifdef LWIP_DEBUG
00107 #define MEMP_OVERFLOW_CHECK         1
00108 #define MEMP_SANITY_CHECK           1
00109 #else
00110 #define LWIP_NOASSERT               1
00111 #define LWIP_STATS                  0
00112 #endif
00113 
00114 #define LWIP_PLATFORM_BYTESWAP      1
00115 
00116 #if LWIP_TRANSPORT_ETHERNET
00117 
00118 /* MSS should match the hardware packet size */
00119 #define TCP_MSS                     1460
00120 #define TCP_SND_BUF                 (2 * TCP_MSS)
00121 #define TCP_WND                     (2 * TCP_MSS)
00122 #define TCP_SND_QUEUELEN            (2 * TCP_SND_BUF/TCP_MSS)
00123 
00124 // Broadcast
00125 #define IP_SOF_BROADCAST            1
00126 #define IP_SOF_BROADCAST_RECV       1
00127 
00128 #define LWIP_BROADCAST_PING         1
00129 
00130 #define LWIP_CHECKSUM_ON_COPY       1
00131 
00132 #define LWIP_NETIF_HOSTNAME         1
00133 #define LWIP_NETIF_STATUS_CALLBACK  1
00134 #define LWIP_NETIF_LINK_CALLBACK    1
00135 
00136 #elif LWIP_TRANSPORT_PPP
00137 
00138 #define TCP_SND_BUF                     (3 * 536)
00139 #define TCP_WND                         (2 * 536)
00140 
00141 #define LWIP_ARP 0
00142 
00143 #define PPP_SUPPORT 1
00144 #define CHAP_SUPPORT                    1
00145 #define PAP_SUPPORT                     1
00146 #define PPP_THREAD_STACKSIZE            4*192
00147 #define PPP_THREAD_PRIO 0
00148 
00149 #define MAXNAMELEN                      64     /* max length of hostname or name for auth */
00150 #define MAXSECRETLEN                    64
00151 
00152 #else
00153 #error A transport mechanism (Ethernet or PPP) must be defined
00154 #endif
00155 
00156 #endif /* LWIPOPTS_H_ */