Web server based weather station using Sparkfun Weather Meters.

Dependencies:   FatFileSystem mbed WeatherMeters SDFileSystem

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 // Set LWIP_DEBUG to 1 to enable extra debugging option in lwIP.
00044 #define LWIP_DEBUG 0
00045 
00046 #if LWIP_DEBUG
00047 
00048 #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
00049 #define TAPIF_DEBUG LWIP_DBG_OFF
00050 #define TUNIF_DEBUG LWIP_DBG_OFF
00051 #define UNIXIF_DEBUG LWIP_DBG_OFF
00052 #define DELIF_DEBUG LWIP_DBG_OFF
00053 #define SIO_FIFO_DEBUG LWIP_DBG_OFF
00054 #define TCPDUMP_DEBUG LWIP_DBG_OFF
00055 
00056 #define PPP_DEBUG        LWIP_DBG_OFF
00057 #define MEM_DEBUG        LWIP_DBG_OFF
00058 #define MEMP_DEBUG       LWIP_DBG_OFF
00059 #define PBUF_DEBUG       LWIP_DBG_OFF
00060 #define API_LIB_DEBUG    LWIP_DBG_OFF
00061 #define API_MSG_DEBUG    LWIP_DBG_OFF
00062 #define TCPIP_DEBUG      LWIP_DBG_OFF
00063 #define NETIF_DEBUG      LWIP_DBG_OFF
00064 #define SOCKETS_DEBUG    LWIP_DBG_OFF
00065 #define DEMO_DEBUG       LWIP_DBG_OFF
00066 #define IP_DEBUG         LWIP_DBG_OFF
00067 #define IP_REASS_DEBUG   LWIP_DBG_OFF
00068 #define RAW_DEBUG        LWIP_DBG_OFF
00069 #define ICMP_DEBUG       LWIP_DBG_OFF
00070 #define IGMP_DEBUG       LWIP_DBG_OFF
00071 #define UDP_DEBUG        LWIP_DBG_OFF
00072 #define TCP_DEBUG        LWIP_DBG_OFF
00073 #define TCP_INPUT_DEBUG  LWIP_DBG_OFF
00074 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
00075 #define TCP_RTO_DEBUG    LWIP_DBG_OFF
00076 #define TCP_CWND_DEBUG   LWIP_DBG_OFF
00077 #define TCP_WND_DEBUG    LWIP_DBG_OFF
00078 #define TCP_FR_DEBUG     LWIP_DBG_OFF
00079 #define TCP_QLEN_DEBUG   LWIP_DBG_OFF
00080 #define TCP_RST_DEBUG    LWIP_DBG_OFF
00081 #define ETHARP_DEBUG     LWIP_DBG_OFF
00082 #define DNS_DEBUG        LWIP_DBG_OFF
00083 
00084 #endif /* LWIP_DEBUG */
00085 
00086 /*
00087 extern unsigned char debug_flags;
00088 #define LWIP_DBG_TYPES_ON debug_flags
00089 */
00090 #define NO_SYS                     1
00091 #define LWIP_SOCKET                (NO_SYS==0)
00092 #define LWIP_NETCONN               (NO_SYS==0)
00093 
00094 
00095 #define IP_FRAG_USES_STATIC_BUF         0
00096 
00097 
00098 
00099 /* Number of HTTP client connections to support at once. */
00100 #define HTTP_CLIENTS            2    // UNDONE: No reason to support more than this for a little embedded device.
00101 
00102 /* Number of buffers to be kept in the HTTP server pool.  Each buffer will
00103    contain TCP_SND_BUF, the maximum number of bytes that can be written to a
00104    TCP/IP connection.  If memory wasn't a limit then we would want to have
00105    2 of these for each client connection.  One with data in it to be written
00106    out to the connection and another keeping already written data around until 
00107   it has been acknowledged by the client.  */
00108 #define HTTP_BUFFER_POOL        HTTP_CLIENTS   // UNDONE: This should be atleast 2x if using a DMA driver.
00109 
00110 /* The number of TCP segments to queue up for each tcp_write() call.
00111    TCP_SND_BUF will be based on this value. */
00112 #define TCP_SEGMENTS_PER_SEND   4
00113 
00114 /* The number of TCP segments in the advertised TCP/IP window.  The HTTP client
00115    can queue up this many inbound segments before waiting for an ACK.
00116    8 * 692 = 5536 which based on LAN ping times and 100Mbit/second bandwidth
00117    should be enough to receive ACK before filling the window. */
00118 #define TCP_SEGMENTS_IN_WND     8
00119 
00120 
00121 
00122 /* ---------- Memory options ---------- */
00123 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
00124    lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
00125    byte alignment -> define MEM_ALIGNMENT to 2. */
00126 #define MEM_ALIGNMENT           4
00127 
00128 /* MEM_SIZE: the size of the heap memory. If the application will send
00129 a lot of data that needs to be copied, this should be set high. */
00130 #define MEM_SIZE                (80 * TCP_SEGMENTS_PER_SEND * HTTP_BUFFER_POOL)  // UNDONE: Shrink this down.  Should only need room for headers ~(80 bytes/header pbuf * 4 segments/send * 2 sends_in_flight)
00131 
00132 // UNDONE: I think this should be in a different header.
00133 #define MEM_POSITION __attribute((section("AHBSRAM1"),aligned))
00134 
00135 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
00136    per active UDP "connection". */
00137 #define MEMP_NUM_UDP_PCB        2   // UNDONE: I only see 2 get used in my testing so decreased it to this value.
00138 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
00139    connections. */
00140 #define MEMP_NUM_TCP_PCB        HTTP_CLIENTS   // UNDONE: I only want to handle 2 HTTP connections at a time.
00141 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
00142    connections. */
00143 #define MEMP_NUM_TCP_PCB_LISTEN 1   // UNDONE: Only listening for HTTP requests on port 80 in my application.
00144 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
00145    segments. */
00146 #define MEMP_NUM_TCP_SEG        (TCP_SEGMENTS_IN_WND * HTTP_CLIENTS + TCP_SEGMENTS_PER_SEND * HTTP_BUFFER_POOL)  // UNDONE: Handle maximum inbound/outbound TCP segments.
00147 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
00148    timeouts. */
00149 #define MEMP_NUM_SYS_TIMEOUT    12  // UNDONE: During a basic test run, I see 7 being the maximum in-use.
00150 
00151 /* The following four are used only with the sequential API and can be
00152    set to 0 if the application only will use the raw API. */
00153 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
00154 #define MEMP_NUM_NETBUF         0
00155 /* MEMP_NUM_NETCONN: the number of struct netconns. */
00156 #define MEMP_NUM_NETCONN        0
00157 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
00158    for sequential API communication and incoming packets. Used in
00159    src/api/tcpip.c. */
00160 #define MEMP_NUM_TCPIP_MSG_API   0
00161 #define MEMP_NUM_TCPIP_MSG_INPKT 0
00162 
00163 /** SYS_LIGHTWEIGHT_PROT
00164  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
00165  * for certain critical regions during buffer allocation, deallocation and memory
00166  * allocation and deallocation.
00167  */
00168 #define SYS_LIGHTWEIGHT_PROT           0 //No sys here
00169 
00170 /* ---------- TCP options ---------- */
00171 #define LWIP_TCP                1
00172 
00173 /* Controls if TCP should queue segments that arrive out of
00174    order. Define to 0 if your device is low on memory. */
00175 #define TCP_QUEUE_OOSEQ         1
00176 
00177 /* The maximum MTU supported by our Ethernet driver. */
00178 #define ETHERNET_MTU            0x2EA   // UNDONE: This is the value in ethdrv.cpp.  Just less than 1/2 of Ethernet's 1500 MTU
00179 
00180 /* TCP Maximum segment size. */
00181 #define TCP_MSS                 (ETHERNET_MTU - 40 - PBUF_LINK_HLEN)    // UNDONE: 40 is the size of the TCP/IP headers.
00182 
00183 /**
00184  * TCP_WND: The size of a TCP window.  This must be at least 
00185  * (2 * TCP_MSS) for things to work well
00186  */
00187 #define TCP_WND                 (TCP_SEGMENTS_IN_WND * TCP_MSS)    // UNDONE: Advertised receive window: 8 * 692 = 5536 which based on LAN ping times and 100Mbit/second bandwidth should be enough to receive ACK before filling the window.
00188 
00189 /* TCP sender buffer space (bytes). */
00190 #define TCP_SND_BUF             (TCP_SEGMENTS_PER_SEND * TCP_MSS)   // UNDONE: The send window is set by the HTTP client.  This just controls how much data the HTTP server can queue up on each poll instance.
00191 
00192 /* TCP sender buffer space (pbufs). This must be at least = 2 *
00193    TCP_SND_BUF/TCP_MSS for things to work. */
00194 #define TCP_SND_QUEUELEN        (2 * TCP_SND_BUF/TCP_MSS)           // UNDONE: (1 for header pbuf and another for rom pbuf to application data)
00195 
00196 
00197 
00198 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
00199    sends a lot of data out of ROM (or other static memory), this
00200    should be set high. */
00201 #define MEMP_NUM_PBUF           (MEMP_NUM_TCP_PCB * (TCP_SND_BUF/TCP_MSS))  // UNDONE: We require one of these for each segment of data we send down for a full window (8) for the 2 sockets we are supporting.
00202 
00203 /* ---------- Pbuf options ---------- */
00204 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
00205 #define PBUF_POOL_SIZE          10      // (MEMP_NUM_TCP_PCB * (TCP_WND/TCP_MSS))  // UNDONE: Similar to MEMP_NUM_PBUF except for inbound packets.
00206 
00207 
00208 
00209 
00210 
00211 
00212 /* ---------- ARP options ---------- */
00213 #define LWIP_ARP                (NET_ETH | NET_ZG2100)
00214 #define ARP_TABLE_SIZE          4
00215 #define ARP_QUEUEING            0
00216 #define ETHARP_TRUST_IP_MAC     1
00217 
00218 /* ---------- IP options ---------- */
00219 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
00220    IP packets across network interfaces. If you are going to run lwIP
00221    on a device with only one network interface, define this to 0. */
00222 #define IP_FORWARD              0
00223 
00224 
00225 /* IP reassembly and segmentation.These are orthogonal even
00226  * if they both deal with IP fragments */
00227  /*
00228 #define IP_REASSEMBLY     1
00229 #define IP_REASS_MAX_PBUFS      10
00230 #define MEMP_NUM_REASSDATA      10
00231 #define IP_FRAG           1
00232 */
00233 /* ---------- ICMP options ---------- */
00234 
00235 /* ---------- IGMP options ---------- */
00236 #define LWIP_IGMP               (NET_ETH | NET_ZG2100)
00237 
00238 /* ---------- DHCP options ---------- */
00239 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
00240    interfaces. */
00241 #define LWIP_DHCP               (NET_ETH | NET_ZG2100)
00242 #define LWIP_NETIF_HOSTNAME     1
00243 
00244 /* 1 if you want to do an ARP check on the offered address
00245    (recommended if using DHCP). */
00246 #define DHCP_DOES_ARP_CHECK     (LWIP_DHCP)
00247 
00248 /* ---------- AUTOIP options ------- */
00249 #define LWIP_AUTOIP             0
00250 
00251 /* ---------- SNMP options ---------- */
00252 /** @todo SNMP is experimental for now
00253     @note UDP must be available for SNMP transport */
00254 #ifndef LWIP_SNMP
00255 #define LWIP_SNMP               0
00256 #endif
00257 
00258 
00259 #ifndef SNMP_PRIVATE_MIB
00260 #define SNMP_PRIVATE_MIB        0
00261 #endif
00262 
00263 
00264 /* ---------- UDP options ---------- */
00265 #define LWIP_UDP                1
00266 
00267 /* ---------- DNS options ---------- */
00268 #define LWIP_DNS                1
00269 
00270 /* ---------- RAW options ---------- */
00271 #define LWIP_RAW                0
00272 
00273 /* ---------- Statistics options ---------- */
00274 /**
00275  * LWIP_STATS==1: Enable statistics collection in lwip_stats.
00276  */
00277 #define LWIP_STATS                      0
00278 
00279 #if LWIP_STATS
00280 /**
00281  * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
00282  */
00283 #define LWIP_STATS_DISPLAY              1
00284 
00285 /**
00286  * LINK_STATS==1: Enable link stats.
00287  */
00288 #define LINK_STATS                      0
00289 
00290 /**
00291  * ETHARP_STATS==1: Enable etharp stats.
00292  */
00293 #define ETHARP_STATS                    0
00294 
00295 /**
00296  * IP_STATS==1: Enable IP stats.
00297  */
00298 #define IP_STATS                        0
00299 
00300 /**
00301  * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is
00302  * on if using either frag or reass.
00303  */
00304 #define IPFRAG_STATS                    0
00305 
00306 /**
00307  * ICMP_STATS==1: Enable ICMP stats.
00308  */
00309 #define ICMP_STATS                      0
00310 
00311 /**
00312  * IGMP_STATS==1: Enable IGMP stats.
00313  */
00314 #define IGMP_STATS                      0
00315 
00316 /**
00317  * UDP_STATS==1: Enable UDP stats. Default is on if
00318  * UDP enabled, otherwise off.
00319  */
00320 #define UDP_STATS                       0
00321 
00322 /**
00323  * TCP_STATS==1: Enable TCP stats. Default is on if TCP
00324  * enabled, otherwise off.
00325  */
00326 #define TCP_STATS                       1
00327 
00328 /**
00329  * MEM_STATS==1: Enable mem.c stats.
00330  */
00331 #define MEM_STATS                       1
00332 
00333 /**
00334  * MEMP_STATS==1: Enable memp.c pool stats.
00335  */
00336 #define MEMP_STATS                      1
00337 
00338 /**
00339  * SYS_STATS==1: Enable system stats (sem and mbox counts, etc).
00340  */
00341 #define SYS_STATS                       0
00342 #endif /* LWIP_STATS */
00343 
00344 
00345 /* ---------- PPP options ---------- */
00346 
00347 #define PPP_SUPPORT      NET_PPP      /* Set > 0 for PPP */
00348 
00349 #if PPP_SUPPORT > 0
00350 
00351 #define NUM_PPP 1           /* Max PPP sessions. */
00352 
00353 
00354 /* Select modules to enable.  Ideally these would be set in the makefile but
00355  * we're limited by the command line length so you need to modify the settings
00356  * in this file.
00357  */
00358 #define PAP_SUPPORT      1      /* Set > 0 for PAP. */
00359 #define CHAP_SUPPORT     1      /* Set > 0 for CHAP. */
00360 #define MSCHAP_SUPPORT   0      /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
00361 #define CBCP_SUPPORT     0      /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
00362 #define CCP_SUPPORT      0      /* Set > 0 for CCP (NOT FUNCTIONAL!) */
00363 #define VJ_SUPPORT       1      /* Set > 0 for VJ header compression. */
00364 #define MD5_SUPPORT      1      /* Set > 0 for MD5 (see also CHAP) */
00365 
00366 
00367 /*
00368  * Timeouts.
00369  */
00370 #define FSM_DEFTIMEOUT        6    /* Timeout time in seconds */
00371 #define FSM_DEFMAXTERMREQS    2    /* Maximum Terminate-Request transmissions */
00372 #define FSM_DEFMAXCONFREQS    10    /* Maximum Configure-Request transmissions */
00373 #define FSM_DEFMAXNAKLOOPS    5    /* Maximum number of nak loops */
00374 
00375 #define UPAP_DEFTIMEOUT        6    /* Timeout (seconds) for retransmitting req */
00376 #define UPAP_DEFREQTIME        30    /* Time to wait for auth-req from peer */
00377 
00378 #define CHAP_DEFTIMEOUT        6    /* Timeout time in seconds */
00379 #define CHAP_DEFTRANSMITS    10    /* max # times to send challenge */
00380 
00381 
00382 /* Interval in seconds between keepalive echo requests, 0 to disable. */
00383 #define LCP_ECHOINTERVAL 0
00384 
00385 
00386 /* Number of unanswered echo requests before failure. */
00387 #define LCP_MAXECHOFAILS 3
00388 
00389 /* Max Xmit idle time (in jiffies) before resend flag char. */
00390 #define PPP_MAXIDLEFLAG 0//Send it every time//100
00391 
00392 /*
00393  * Packet sizes
00394  *
00395  * Note - lcp shouldn't be allowed to negotiate stuff outside these
00396  *    limits.  See lcp.h in the pppd directory.
00397  * (XXX - these constants should simply be shared by lcp.c instead
00398  *    of living in lcp.h)
00399  */
00400 #define PPP_MTU     1500     /* Default MTU (size of Info field) */
00401 #if 0
00402 #define PPP_MAXMTU  65535 - (PPP_HDRLEN + PPP_FCSLEN)
00403 #else
00404 
00405 #define PPP_MAXMTU  1500 /* Largest MTU we allow */
00406 #endif
00407 
00408 #define PPP_MINMTU  64
00409 #define PPP_MRU     1500     /* default MRU = max length of info field */
00410 #define PPP_MAXMRU  1500     /* Largest MRU we allow */
00411 #define PPP_DEFMRU    296        /* Try for this */
00412 #define PPP_MINMRU    128        /* No MRUs below this */
00413 
00414 
00415 #define MAXNAMELEN      64     /* max length of hostname or name for auth */
00416 #define MAXSECRETLEN    64     /* max length of password or secret */
00417 
00418 #endif /* PPP_SUPPORT > 0 */
00419 
00420 //C++ Compat
00421 #define try vTry
00422 
00423 #endif
00424 
00425 
00426 #endif /* __LWIPOPTS_H__ */