NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lwipopts.h Source File

lwipopts.h

00001 /*
00002  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
00003  * All rights reserved. 
00004  * 
00005  * Redistribution and use in source and binary forms, with or without modification, 
00006  * are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright notice,
00009  *    this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright notice,
00011  *    this list of conditions and the following disclaimer in the documentation
00012  *    and/or other materials provided with the distribution.
00013  * 3. The name of the author may not be used to endorse or promote products
00014  *    derived from this software without specific prior written permission. 
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
00017  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00018  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00019  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00020  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00021  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00024  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00025  * OF SUCH DAMAGE.
00026  *
00027  * This file is part of the lwIP TCP/IP stack.
00028  * 
00029  * Author: Adam Dunkels <adam@sics.se>
00030  *
00031  */
00032 #ifndef __LWIPOPTS_H__
00033 #define __LWIPOPTS_H__
00034 
00035 #include "netCfg.h"
00036 #if NET_LWIP_STACK
00037 
00038 //#include "arch/sys_arch.h"
00039 
00040 /* <sys/time.h> is included in cc.h! */
00041 #define LWIP_TIMEVAL_PRIVATE 0
00042 
00043 //#define __LWIP_DEBUG
00044 #include "dbg/dbg.h"
00045 
00046 #ifdef __LWIP_DEBUG
00047 
00048 #define LWIP_DEBUG 1
00049 
00050 #define LWIP_DBG_MIN_LEVEL 0
00051 //#define LWIP_COMPAT_SOCKETS 1
00052 #define TAPIF_DEBUG LWIP_DBG_OFF
00053 #define TUNIF_DEBUG LWIP_DBG_OFF
00054 #define UNIXIF_DEBUG LWIP_DBG_OFF
00055 #define DELIF_DEBUG LWIP_DBG_OFF
00056 #define SIO_FIFO_DEBUG LWIP_DBG_ON
00057 #define TCPDUMP_DEBUG LWIP_DBG_ON
00058 
00059 #define PPP_DEBUG        LWIP_DBG_OFF
00060 #define MEM_DEBUG        LWIP_DBG_OFF
00061 #define MEMP_DEBUG       LWIP_DBG_OFF
00062 #define PBUF_DEBUG       LWIP_DBG_OFF
00063 #define API_LIB_DEBUG    LWIP_DBG_OFF
00064 #define API_MSG_DEBUG    LWIP_DBG_OFF
00065 #define TCPIP_DEBUG      LWIP_DBG_OFF
00066 #define NETIF_DEBUG      LWIP_DBG_OFF
00067 #define SOCKETS_DEBUG    LWIP_DBG_OFF
00068 #define DEMO_DEBUG       LWIP_DBG_OFF
00069 #define IP_DEBUG         LWIP_DBG_OFF
00070 #define IP_REASS_DEBUG   LWIP_DBG_OFF
00071 #define RAW_DEBUG        LWIP_DBG_OFF
00072 #define ICMP_DEBUG       LWIP_DBG_OFF
00073 #define IGMP_DEBUG       LWIP_DBG_OFF
00074 #define UDP_DEBUG        LWIP_DBG_OFF
00075 #define TCP_DEBUG        LWIP_DBG_OFF
00076 #define TCP_INPUT_DEBUG  LWIP_DBG_OFF
00077 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
00078 #define TCP_RTO_DEBUG    LWIP_DBG_OFF
00079 #define TCP_CWND_DEBUG   LWIP_DBG_OFF
00080 #define TCP_WND_DEBUG    LWIP_DBG_OFF
00081 #define TCP_FR_DEBUG     LWIP_DBG_OFF
00082 #define TCP_QLEN_DEBUG   LWIP_DBG_OFF
00083 #define TCP_RST_DEBUG    LWIP_DBG_OFF
00084 #define ETHARP_DEBUG     LWIP_DBG_OFF
00085 #define DNS_DEBUG        LWIP_DBG_OFF
00086 
00087 #endif
00088 
00089 /*
00090 extern unsigned char debug_flags;
00091 #define LWIP_DBG_TYPES_ON debug_flags
00092 */
00093 #define NO_SYS                     1
00094 #define LWIP_SOCKET                (NO_SYS==0)
00095 #define LWIP_NETCONN               (NO_SYS==0)
00096 
00097 
00098 #define IP_FRAG_USES_STATIC_BUF         0
00099 
00100 
00101 
00102 /* ---------- Memory options ---------- */
00103 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
00104    lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
00105    byte alignment -> define MEM_ALIGNMENT to 2. */
00106 /* MSVC port: intel processors don't need 4-byte alignment,
00107    but are faster that way! */
00108 #define MEM_ALIGNMENT           4
00109 
00110 /* MEM_SIZE: the size of the heap memory. If the application will send
00111 a lot of data that needs to be copied, this should be set high. */
00112 //#define MEM_SIZE               10240 
00113 
00114 #if TARGET_LPC1768
00115 
00116 
00117 #define MEM_SIZE               3000 //2000
00118 
00119 ///
00120 
00121 #define MEM_POSITION __attribute((section("AHBSRAM0")))
00122 
00123 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
00124    sends a lot of data out of ROM (or other static memory), this
00125    should be set high. */
00126 #define MEMP_NUM_PBUF           16
00127 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
00128    per active RAW "connection". */
00129 //#define MEMP_NUM_RAW_PCB        3
00130 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
00131    per active UDP "connection". */
00132 #define MEMP_NUM_UDP_PCB        4
00133 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
00134    connections. */
00135 #define MEMP_NUM_TCP_PCB        3
00136 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
00137    connections. */
00138 #define MEMP_NUM_TCP_PCB_LISTEN 2//4
00139 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
00140    segments. */
00141 #define MEMP_NUM_TCP_SEG        16
00142 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
00143    timeouts. */
00144 #define MEMP_NUM_SYS_TIMEOUT    12
00145 
00146 /* The following four are used only with the sequential API and can be
00147    set to 0 if the application only will use the raw API. */
00148 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
00149 #define MEMP_NUM_NETBUF         0
00150 /* MEMP_NUM_NETCONN: the number of struct netconns. */
00151 #define MEMP_NUM_NETCONN        0
00152 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
00153    for sequential API communication and incoming packets. Used in
00154    src/api/tcpip.c. */
00155 #define MEMP_NUM_TCPIP_MSG_API   0
00156 #define MEMP_NUM_TCPIP_MSG_INPKT 0
00157 
00158 /* ---------- Pbuf options ---------- */
00159 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
00160 #define PBUF_POOL_SIZE          8//16//100
00161 
00162 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
00163 //#define PBUF_POOL_BUFSIZE       128
00164 
00165 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
00166    link level header. */
00167 //#define PBUF_LINK_HLEN          16 
00168 
00169 /** SYS_LIGHTWEIGHT_PROT
00170  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
00171  * for certain critical regions during buffer allocation, deallocation and memory
00172  * allocation and deallocation.
00173  */
00174 #define SYS_LIGHTWEIGHT_PROT           0 //No sys here
00175 
00176 /* ---------- TCP options ---------- */
00177 #define LWIP_TCP                1
00178 //#define TCP_TTL                 255
00179 
00180 /* Controls if TCP should queue segments that arrive out of
00181    order. Define to 0 if your device is low on memory. */
00182 #define TCP_QUEUE_OOSEQ         1
00183 
00184 /* TCP Maximum segment size. */
00185 //#define TCP_MSS                 1024
00186 #define TCP_MSS                   536//1024//536//0x276
00187 
00188 /* TCP sender buffer space (bytes). */
00189 #define TCP_SND_BUF             (3 * TCP_MSS) //2048
00190 
00191 /* TCP sender buffer space (pbufs). This must be at least = 2 *
00192    TCP_SND_BUF/TCP_MSS for things to work. */
00193 #define TCP_SND_QUEUELEN        (4 * (TCP_SND_BUF)/(TCP_MSS))
00194 
00195 /* TCP writable space (bytes). This must be less than or equal
00196    to TCP_SND_BUF. It is the amount of space which must be
00197    available in the tcp snd_buf for select to return writable */
00198 #define TCP_SNDLOWAT        ((TCP_SND_BUF)/2)
00199 
00200 /**
00201  * TCP_WND: The size of a TCP window.  This must be at least 
00202  * (2 * TCP_MSS) for things to work well
00203  */
00204 /* TCP receive window. */
00205 #define TCP_WND        (4 * TCP_MSS)         //8096
00206 
00207 /* Maximum number of retransmissions of data segments. */
00208 //#define TCP_MAXRTX              12
00209 
00210 /* Maximum number of retransmissions of SYN segments. */
00211 //#define TCP_SYNMAXRTX           4
00212 
00213 #elif TARGET_LPC2368
00214 
00215 #define MEM_POSITION __attribute((section("AHBSRAM1")))
00216 
00217 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
00218    sends a lot of data out of ROM (or other static memory), this
00219    should be set high. */
00220 #define MEMP_NUM_PBUF           8
00221 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
00222    per active RAW "connection". */
00223 //#define MEMP_NUM_RAW_PCB        3
00224 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
00225    per active UDP "connection". */
00226 #define MEMP_NUM_UDP_PCB        2
00227 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
00228    connections. */
00229 #define MEMP_NUM_TCP_PCB        2
00230 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
00231    connections. */
00232 #define MEMP_NUM_TCP_PCB_LISTEN 2//4
00233 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
00234    segments. */
00235 #define MEMP_NUM_TCP_SEG        8
00236 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
00237    timeouts. */
00238 #define MEMP_NUM_SYS_TIMEOUT    12
00239 
00240 /* The following four are used only with the sequential API and can be
00241    set to 0 if the application only will use the raw API. */
00242 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
00243 #define MEMP_NUM_NETBUF         0
00244 /* MEMP_NUM_NETCONN: the number of struct netconns. */
00245 #define MEMP_NUM_NETCONN        0
00246 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
00247    for sequential API communication and incoming packets. Used in
00248    src/api/tcpip.c. */
00249 #define MEMP_NUM_TCPIP_MSG_API   0
00250 #define MEMP_NUM_TCPIP_MSG_INPKT 0
00251 
00252 /* ---------- Pbuf options ---------- */
00253 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
00254 #define PBUF_POOL_SIZE          8//16//100
00255 
00256 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
00257 //#define PBUF_POOL_BUFSIZE       128
00258 
00259 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
00260    link level header. */
00261 //#define PBUF_LINK_HLEN          16 
00262 
00263 /** SYS_LIGHTWEIGHT_PROT
00264  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
00265  * for certain critical regions during buffer allocation, deallocation and memory
00266  * allocation and deallocation.
00267  */
00268 #define SYS_LIGHTWEIGHT_PROT           0 //No sys here
00269 
00270 /* ---------- TCP options ---------- */
00271 #define LWIP_TCP                1
00272 #define TCP_TTL                 255
00273 
00274 /* Controls if TCP should queue segments that arrive out of
00275    order. Define to 0 if your device is low on memory. */
00276 #define TCP_QUEUE_OOSEQ         0
00277 
00278 /* TCP Maximum segment size. */
00279 //#define TCP_MSS                 1024
00280 #define TCP_MSS                   536//0x276//536//0x276
00281 
00282 /* TCP sender buffer space (bytes). */
00283 #define TCP_SND_BUF             (3 * TCP_MSS)
00284 
00285 /* TCP sender buffer space (pbufs). This must be at least = 2 *
00286    TCP_SND_BUF/TCP_MSS for things to work. */
00287 #define TCP_SND_QUEUELEN        (2 * TCP_SND_BUF/TCP_MSS)//(4 * TCP_SND_BUF/TCP_MSS)
00288 
00289 /* TCP writable space (bytes). This must be less than or equal
00290    to TCP_SND_BUF. It is the amount of space which must be
00291    available in the tcp snd_buf for select to return writable */
00292 #define TCP_SNDLOWAT        (TCP_SND_BUF/2)
00293 
00294 /* TCP receive window. */
00295 #define TCP_WND        (3 * TCP_MSS)         //8096
00296 
00297 /* Maximum number of retransmissions of data segments. */
00298 //#define TCP_MAXRTX              12
00299 
00300 /* Maximum number of retransmissions of SYN segments. */
00301 //#define TCP_SYNMAXRTX           4
00302 
00303 #endif
00304 
00305 /* ---------- ARP options ---------- */
00306 #define LWIP_ARP                (NET_ETH | NET_ZG2100)
00307 #define ARP_TABLE_SIZE          4//10
00308 #define ARP_QUEUEING            0
00309 #define ETHARP_TRUST_IP_MAC     1
00310 
00311 /* ---------- IP options ---------- */
00312 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
00313    IP packets across network interfaces. If you are going to run lwIP
00314    on a device with only one network interface, define this to 0. */
00315 #define IP_FORWARD              0
00316 
00317 
00318 /* IP reassembly and segmentation.These are orthogonal even
00319  * if they both deal with IP fragments */
00320  /*
00321 #define IP_REASSEMBLY     1
00322 #define IP_REASS_MAX_PBUFS      10
00323 #define MEMP_NUM_REASSDATA      10
00324 #define IP_FRAG           1
00325 */
00326 /* ---------- ICMP options ---------- */
00327 #define ICMP_TTL                255
00328 
00329 /* ---------- IGMP options ---------- */
00330 #define LWIP_IGMP               (NET_ETH | NET_ZG2100)
00331 
00332 /* ---------- DHCP options ---------- */
00333 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
00334    interfaces. */
00335 #define LWIP_DHCP               (NET_ETH | NET_ZG2100)
00336 
00337 /* 1 if you want to do an ARP check on the offered address
00338    (recommended if using DHCP). */
00339 #define DHCP_DOES_ARP_CHECK     (LWIP_DHCP)
00340 
00341 /* ---------- AUTOIP options ------- */
00342 #define LWIP_AUTOIP             0
00343 
00344 /* ---------- SNMP options ---------- */
00345 /** @todo SNMP is experimental for now
00346     @note UDP must be available for SNMP transport */
00347 #ifndef LWIP_SNMP
00348 #define LWIP_SNMP               0
00349 #endif
00350 
00351 
00352 #ifndef SNMP_PRIVATE_MIB
00353 #define SNMP_PRIVATE_MIB        0
00354 #endif
00355 
00356 
00357 /* ---------- UDP options ---------- */
00358 #define LWIP_UDP                1
00359 #define UDP_TTL                 255
00360 
00361 /* ---------- DNS options ---------- */
00362 #define LWIP_DNS                1
00363 
00364 /* ---------- RAW options ---------- */
00365 #define LWIP_RAW                0
00366 #define RAW_TTL                 255
00367 
00368 /* ---------- Statistics options ---------- */
00369 /* individual STATS options can be turned off by defining them to 0 
00370  * (e.g #define TCP_STATS 0). All of them are turned off if LWIP_STATS
00371  * is 0
00372  * */
00373 
00374 #define LWIP_STATS    0
00375 
00376 /* ---------- PPP options ---------- */
00377 
00378 #define PPP_SUPPORT      NET_PPP      /* Set > 0 for PPP */
00379 
00380 #if PPP_SUPPORT > 0
00381 
00382 #define NUM_PPP 1           /* Max PPP sessions. */
00383 
00384 
00385 /* Select modules to enable.  Ideally these would be set in the makefile but
00386  * we're limited by the command line length so you need to modify the settings
00387  * in this file.
00388  */
00389 #define PAP_SUPPORT      1      /* Set > 0 for PAP. */
00390 #define CHAP_SUPPORT     1      /* Set > 0 for CHAP. */
00391 #define MSCHAP_SUPPORT   0      /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
00392 #define CBCP_SUPPORT     0      /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
00393 #define CCP_SUPPORT      0      /* Set > 0 for CCP (NOT FUNCTIONAL!) */
00394 #define VJ_SUPPORT       1      /* Set > 0 for VJ header compression. */
00395 #define MD5_SUPPORT      1      /* Set > 0 for MD5 (see also CHAP) */
00396 
00397 
00398 /*
00399  * Timeouts.
00400  */
00401 #define FSM_DEFTIMEOUT        6    /* Timeout time in seconds */
00402 #define FSM_DEFMAXTERMREQS    2    /* Maximum Terminate-Request transmissions */
00403 #define FSM_DEFMAXCONFREQS    10    /* Maximum Configure-Request transmissions */
00404 #define FSM_DEFMAXNAKLOOPS    5    /* Maximum number of nak loops */
00405 
00406 #define UPAP_DEFTIMEOUT        6    /* Timeout (seconds) for retransmitting req */
00407 #define UPAP_DEFREQTIME        30    /* Time to wait for auth-req from peer */
00408 
00409 #define CHAP_DEFTIMEOUT        6    /* Timeout time in seconds */
00410 #define CHAP_DEFTRANSMITS    10    /* max # times to send challenge */
00411 
00412 
00413 /* Interval in seconds between keepalive echo requests, 0 to disable. */
00414 #if 1
00415 #define LCP_ECHOINTERVAL 0
00416 #else
00417 
00418 #define LCP_ECHOINTERVAL 10
00419 #endif
00420 
00421 
00422 /* Number of unanswered echo requests before failure. */
00423 #define LCP_MAXECHOFAILS 3
00424 
00425 /* Max Xmit idle time (in jiffies) before resend flag char. */
00426 #define PPP_MAXIDLEFLAG 0//Send it every time//100
00427 
00428 /*
00429  * Packet sizes
00430  *
00431  * Note - lcp shouldn't be allowed to negotiate stuff outside these
00432  *    limits.  See lcp.h in the pppd directory.
00433  * (XXX - these constants should simply be shared by lcp.c instead
00434  *    of living in lcp.h)
00435  */
00436 #define PPP_MTU     1500     /* Default MTU (size of Info field) */
00437 #if 0
00438 #define PPP_MAXMTU  65535 - (PPP_HDRLEN + PPP_FCSLEN)
00439 #else
00440 
00441 #define PPP_MAXMTU  1500 /* Largest MTU we allow */
00442 #endif
00443 
00444 #define PPP_MINMTU  64
00445 #define PPP_MRU     1500     /* default MRU = max length of info field */
00446 #define PPP_MAXMRU  1500     /* Largest MRU we allow */
00447 #define PPP_DEFMRU    296        /* Try for this */
00448 #define PPP_MINMRU    128        /* No MRUs below this */
00449 
00450 
00451 #define MAXNAMELEN      64     /* max length of hostname or name for auth */
00452 #define MAXSECRETLEN    64     /* max length of password or secret */
00453 
00454 #endif /* PPP_SUPPORT > 0 */
00455 
00456 //C++ Compat
00457 #define try vTry
00458 
00459 #endif
00460 
00461 
00462 #endif /* __LWIPOPTS_H__ */