NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lwipopts2.h Source File

lwipopts2.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_OFF
00057 #define TCPDUMP_DEBUG LWIP_DBG_OFF
00058 
00059 #define PPP_DEBUG        LWIP_DBG_OFF
00060 #define MEM_DEBUG        LWIP_DBG_ON
00061 #define MEMP_DEBUG       LWIP_DBG_ON
00062 #define PBUF_DEBUG       LWIP_DBG_ON
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 UDP_DEBUG        LWIP_DBG_OFF
00074 #define TCP_DEBUG        LWIP_DBG_OFF
00075 #define TCP_INPUT_DEBUG  LWIP_DBG_OFF
00076 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
00077 #define TCP_RTO_DEBUG    LWIP_DBG_OFF
00078 #define TCP_CWND_DEBUG   LWIP_DBG_OFF
00079 #define TCP_WND_DEBUG    LWIP_DBG_OFF
00080 #define TCP_FR_DEBUG     LWIP_DBG_OFF
00081 #define TCP_QLEN_DEBUG   LWIP_DBG_OFF
00082 #define TCP_RST_DEBUG    LWIP_DBG_OFF
00083 #define ETHARP_DEBUG     LWIP_DBG_OFF
00084 #define DNS_DEBUG        LWIP_DBG_OFF
00085 
00086 #endif
00087 
00088 /*
00089 extern unsigned char debug_flags;
00090 #define LWIP_DBG_TYPES_ON debug_flags
00091 */
00092 #define NO_SYS                     1
00093 #define LWIP_SOCKET                (NO_SYS==0)
00094 #define LWIP_NETCONN               (NO_SYS==0)
00095 
00096 
00097 #define IP_FRAG_USES_STATIC_BUF         0
00098 
00099 
00100 
00101 /* ---------- Memory options ---------- */
00102 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
00103    lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
00104    byte alignment -> define MEM_ALIGNMENT to 2. */
00105 /* MSVC port: intel processors don't need 4-byte alignment,
00106    but are faster that way! */
00107 #define MEM_ALIGNMENT           4
00108 
00109 /* MEM_SIZE: the size of the heap memory. If the application will send
00110 a lot of data that needs to be copied, this should be set high. */
00111 //#define MEM_SIZE               10240 
00112 
00113 #if TARGET_LPC1768
00114 
00115 
00116 #define MEM_SIZE               4000
00117 
00118 ///
00119 
00120 #define MEM_POSITION __attribute((section("AHBSRAM0")))
00121 
00122 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
00123    sends a lot of data out of ROM (or other static memory), this
00124    should be set high. */
00125 #define MEMP_NUM_PBUF           16
00126 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
00127    per active RAW "connection". */
00128 //#define MEMP_NUM_RAW_PCB        3
00129 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
00130    per active UDP "connection". */
00131 #define MEMP_NUM_UDP_PCB        2
00132 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
00133    connections. */
00134 #define MEMP_NUM_TCP_PCB        2
00135 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
00136    connections. */
00137 #define MEMP_NUM_TCP_PCB_LISTEN 2//4
00138 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
00139    segments. */
00140 #define MEMP_NUM_TCP_SEG        16
00141 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
00142    timeouts. */
00143 #define MEMP_NUM_SYS_TIMEOUT    12
00144 
00145 /* The following four are used only with the sequential API and can be
00146    set to 0 if the application only will use the raw API. */
00147 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
00148 #define MEMP_NUM_NETBUF         0
00149 /* MEMP_NUM_NETCONN: the number of struct netconns. */
00150 #define MEMP_NUM_NETCONN        0
00151 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
00152    for sequential API communication and incoming packets. Used in
00153    src/api/tcpip.c. */
00154 #define MEMP_NUM_TCPIP_MSG_API   0
00155 #define MEMP_NUM_TCPIP_MSG_INPKT 0
00156 
00157 /* ---------- Pbuf options ---------- */
00158 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
00159 #define PBUF_POOL_SIZE          8//100
00160 
00161 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
00162 #define PBUF_POOL_BUFSIZE       128
00163 
00164 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
00165    link level header. */
00166 //#define PBUF_LINK_HLEN          16 
00167 
00168 /** SYS_LIGHTWEIGHT_PROT
00169  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
00170  * for certain critical regions during buffer allocation, deallocation and memory
00171  * allocation and deallocation.
00172  */
00173 #define SYS_LIGHTWEIGHT_PROT           0 //No sys here
00174 
00175 /* ---------- TCP options ---------- */
00176 #define LWIP_TCP                1
00177 #define TCP_TTL                 255
00178 
00179 /* Controls if TCP should queue segments that arrive out of
00180    order. Define to 0 if your device is low on memory. */
00181 #define TCP_QUEUE_OOSEQ         0
00182 
00183 /* TCP Maximum segment size. */
00184 //#define TCP_MSS                 1024
00185 #define TCP_MSS                   0x276//536//0x276
00186 
00187 /* TCP sender buffer space (bytes). */
00188 #define TCP_SND_BUF             2048
00189 
00190 /* TCP sender buffer space (pbufs). This must be at least = 2 *
00191    TCP_SND_BUF/TCP_MSS for things to work. */
00192 #define TCP_SND_QUEUELEN        (2 * TCP_SND_BUF/TCP_MSS)
00193 
00194 /* TCP writable space (bytes). This must be less than or equal
00195    to TCP_SND_BUF. It is the amount of space which must be
00196    available in the tcp snd_buf for select to return writable */
00197 #define TCP_SNDLOWAT        (TCP_SND_BUF/2)
00198 
00199 /* TCP receive window. */
00200 #define TCP_WND        2048         //8096
00201 
00202 /* Maximum number of retransmissions of data segments. */
00203 //#define TCP_MAXRTX              12
00204 
00205 /* Maximum number of retransmissions of SYN segments. */
00206 //#define TCP_SYNMAXRTX           4
00207 
00208 #elif TARGET_LPC2368
00209 
00210 #define MEM_POSITION __attribute((section("AHBSRAM1")))
00211 
00212 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
00213    sends a lot of data out of ROM (or other static memory), this
00214    should be set high. */
00215 #define MEMP_NUM_PBUF           8
00216 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
00217    per active RAW "connection". */
00218 //#define MEMP_NUM_RAW_PCB        3
00219 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
00220    per active UDP "connection". */
00221 #define MEMP_NUM_UDP_PCB        2
00222 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
00223    connections. */
00224 #define MEMP_NUM_TCP_PCB        2
00225 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
00226    connections. */
00227 #define MEMP_NUM_TCP_PCB_LISTEN 2//4
00228 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
00229    segments. */
00230 #define MEMP_NUM_TCP_SEG        8
00231 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
00232    timeouts. */
00233 #define MEMP_NUM_SYS_TIMEOUT    12
00234 
00235 /* The following four are used only with the sequential API and can be
00236    set to 0 if the application only will use the raw API. */
00237 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
00238 #define MEMP_NUM_NETBUF         0
00239 /* MEMP_NUM_NETCONN: the number of struct netconns. */
00240 #define MEMP_NUM_NETCONN        0
00241 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
00242    for sequential API communication and incoming packets. Used in
00243    src/api/tcpip.c. */
00244 #define MEMP_NUM_TCPIP_MSG_API   0
00245 #define MEMP_NUM_TCPIP_MSG_INPKT 0
00246 
00247 /* ---------- Pbuf options ---------- */
00248 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
00249 #define PBUF_POOL_SIZE          8//16//100
00250 
00251 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
00252 //#define PBUF_POOL_BUFSIZE       128
00253 
00254 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
00255    link level header. */
00256 //#define PBUF_LINK_HLEN          16 
00257 
00258 /** SYS_LIGHTWEIGHT_PROT
00259  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
00260  * for certain critical regions during buffer allocation, deallocation and memory
00261  * allocation and deallocation.
00262  */
00263 #define SYS_LIGHTWEIGHT_PROT           0 //No sys here
00264 
00265 /* ---------- TCP options ---------- */
00266 #define LWIP_TCP                1
00267 #define TCP_TTL                 255
00268 
00269 /* Controls if TCP should queue segments that arrive out of
00270    order. Define to 0 if your device is low on memory. */
00271 #define TCP_QUEUE_OOSEQ         0
00272 
00273 /* TCP Maximum segment size. */
00274 //#define TCP_MSS                 1024
00275 #define TCP_MSS                   512//0x276//536//0x276
00276 
00277 /* TCP sender buffer space (bytes). */
00278 #define TCP_SND_BUF             1024//2048
00279 
00280 /* TCP sender buffer space (pbufs). This must be at least = 2 *
00281    TCP_SND_BUF/TCP_MSS for things to work. */
00282 #define TCP_SND_QUEUELEN        (4 * TCP_SND_BUF/TCP_MSS)//(4 * TCP_SND_BUF/TCP_MSS)
00283 
00284 /* TCP writable space (bytes). This must be less than or equal
00285    to TCP_SND_BUF. It is the amount of space which must be
00286    available in the tcp snd_buf for select to return writable */
00287 #define TCP_SNDLOWAT        (TCP_SND_BUF/2)
00288 
00289 /* TCP receive window. */
00290 #define TCP_WND        512         //8096
00291 
00292 /* Maximum number of retransmissions of data segments. */
00293 //#define TCP_MAXRTX              12
00294 
00295 /* Maximum number of retransmissions of SYN segments. */
00296 //#define TCP_SYNMAXRTX           4
00297 
00298 #endif
00299 
00300 /* ---------- ARP options ---------- */
00301 #define LWIP_ARP                (NET_ETH | NET_ZG2100)
00302 #define ARP_TABLE_SIZE          2//4//10
00303 #define ARP_QUEUEING            0//1
00304 #define ETHARP_TRUST_IP_MAC     1
00305 
00306 /* ---------- IP options ---------- */
00307 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
00308    IP packets across network interfaces. If you are going to run lwIP
00309    on a device with only one network interface, define this to 0. */
00310 #define IP_FORWARD              0
00311 
00312 
00313 /* IP reassembly and segmentation.These are orthogonal even
00314  * if they both deal with IP fragments */
00315  /*
00316 #define IP_REASSEMBLY     1
00317 #define IP_REASS_MAX_PBUFS      10
00318 #define MEMP_NUM_REASSDATA      10
00319 #define IP_FRAG           1
00320 */
00321 /* ---------- ICMP options ---------- */
00322 #define ICMP_TTL                255
00323 
00324 /* ---------- DHCP options ---------- */
00325 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
00326    interfaces. */
00327 #define LWIP_DHCP               (NET_ETH | NET_ZG2100)
00328 
00329 /* 1 if you want to do an ARP check on the offered address
00330    (recommended if using DHCP). */
00331 #define DHCP_DOES_ARP_CHECK     (LWIP_DHCP)
00332 
00333 /* ---------- AUTOIP options ------- */
00334 #define LWIP_AUTOIP             0
00335 
00336 /* ---------- SNMP options ---------- */
00337 /** @todo SNMP is experimental for now
00338     @note UDP must be available for SNMP transport */
00339 #ifndef LWIP_SNMP
00340 #define LWIP_SNMP               0
00341 #endif
00342 
00343 
00344 #ifndef SNMP_PRIVATE_MIB
00345 #define SNMP_PRIVATE_MIB        0
00346 #endif
00347 
00348 
00349 /* ---------- UDP options ---------- */
00350 #define LWIP_UDP                1
00351 #define UDP_TTL                 255
00352 
00353 /* ---------- DNS options ---------- */
00354 #define LWIP_DNS                1
00355 
00356 /* ---------- RAW options ---------- */
00357 #define LWIP_RAW                0
00358 #define RAW_TTL                 255
00359 
00360 /* ---------- Statistics options ---------- */
00361 /* individual STATS options can be turned off by defining them to 0 
00362  * (e.g #define TCP_STATS 0). All of them are turned off if LWIP_STATS
00363  * is 0
00364  * */
00365 
00366 #define LWIP_STATS    0
00367 
00368 /* ---------- PPP options ---------- */
00369 
00370 #define PPP_SUPPORT      NET_PPP      /* Set > 0 for PPP */
00371 
00372 #if PPP_SUPPORT > 0
00373 
00374 #define NUM_PPP 1           /* Max PPP sessions. */
00375 
00376 
00377 /* Select modules to enable.  Ideally these would be set in the makefile but
00378  * we're limited by the command line length so you need to modify the settings
00379  * in this file.
00380  */
00381 #define PAP_SUPPORT      1      /* Set > 0 for PAP. */
00382 #define CHAP_SUPPORT     1      /* Set > 0 for CHAP. */
00383 #define MSCHAP_SUPPORT   0      /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
00384 #define CBCP_SUPPORT     0      /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
00385 #define CCP_SUPPORT      0      /* Set > 0 for CCP (NOT FUNCTIONAL!) */
00386 #define VJ_SUPPORT       1      /* Set > 0 for VJ header compression. */
00387 #define MD5_SUPPORT      1      /* Set > 0 for MD5 (see also CHAP) */
00388 
00389 
00390 /*
00391  * Timeouts.
00392  */
00393 #define FSM_DEFTIMEOUT        6    /* Timeout time in seconds */
00394 #define FSM_DEFMAXTERMREQS    2    /* Maximum Terminate-Request transmissions */
00395 #define FSM_DEFMAXCONFREQS    10    /* Maximum Configure-Request transmissions */
00396 #define FSM_DEFMAXNAKLOOPS    5    /* Maximum number of nak loops */
00397 
00398 #define UPAP_DEFTIMEOUT        6    /* Timeout (seconds) for retransmitting req */
00399 #define UPAP_DEFREQTIME        30    /* Time to wait for auth-req from peer */
00400 
00401 #define CHAP_DEFTIMEOUT        6    /* Timeout time in seconds */
00402 #define CHAP_DEFTRANSMITS    10    /* max # times to send challenge */
00403 
00404 
00405 /* Interval in seconds between keepalive echo requests, 0 to disable. */
00406 #if 1
00407 #define LCP_ECHOINTERVAL 0
00408 #else
00409 
00410 #define LCP_ECHOINTERVAL 10
00411 #endif
00412 
00413 
00414 /* Number of unanswered echo requests before failure. */
00415 #define LCP_MAXECHOFAILS 3
00416 
00417 /* Max Xmit idle time (in jiffies) before resend flag char. */
00418 #define PPP_MAXIDLEFLAG 0//Send it every time//100
00419 
00420 /*
00421  * Packet sizes
00422  *
00423  * Note - lcp shouldn't be allowed to negotiate stuff outside these
00424  *    limits.  See lcp.h in the pppd directory.
00425  * (XXX - these constants should simply be shared by lcp.c instead
00426  *    of living in lcp.h)
00427  */
00428 #define PPP_MTU     1500     /* Default MTU (size of Info field) */
00429 #if 0
00430 #define PPP_MAXMTU  65535 - (PPP_HDRLEN + PPP_FCSLEN)
00431 #else
00432 
00433 #define PPP_MAXMTU  1500 /* Largest MTU we allow */
00434 #endif
00435 
00436 #define PPP_MINMTU  64
00437 #define PPP_MRU     1500     /* default MRU = max length of info field */
00438 #define PPP_MAXMRU  1500     /* Largest MRU we allow */
00439 #define PPP_DEFMRU    296        /* Try for this */
00440 #define PPP_MINMRU    128        /* No MRUs below this */
00441 
00442 
00443 #define MAXNAMELEN      64     /* max length of hostname or name for auth */
00444 #define MAXSECRETLEN    64     /* max length of password or secret */
00445 
00446 #endif /* PPP_SUPPORT > 0 */
00447 
00448 //C++ Compat
00449 #define try vTry
00450 
00451 #endif
00452 
00453 
00454 #endif /* __LWIPOPTS_H__ */