Advertisement
Guest User

Untitled

a guest
Nov 5th, 2017
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.68 KB | None | 0 0
  1. /**
  2.  * @file
  3.  *
  4.  * lwIP Options Configuration
  5.  */
  6.  
  7. /*
  8.  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
  9.  * All rights reserved.
  10.  *
  11.  * Redistribution and use in source and binary forms, with or without modification,
  12.  * are permitted provided that the following conditions are met:
  13.  *
  14.  * 1. Redistributions of source code must retain the above copyright notice,
  15.  *    this list of conditions and the following disclaimer.
  16.  * 2. Redistributions in binary form must reproduce the above copyright notice,
  17.  *    this list of conditions and the following disclaimer in the documentation
  18.  *    and/or other materials provided with the distribution.
  19.  * 3. The name of the author may not be used to endorse or promote products
  20.  *    derived from this software without specific prior written permission.
  21.  *
  22.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  23.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  24.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  25.  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  27.  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  28.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  29.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  30.  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  31.  * OF SUCH DAMAGE.
  32.  *
  33.  * This file is part of the lwIP TCP/IP stack.
  34.  *
  35.  * Author: Adam Dunkels <adam@sics.se>
  36.  *
  37.  */
  38. #ifndef LWIP_LWIPOPTS_H
  39. #define LWIP_LWIPOPTS_H
  40.  
  41. /*
  42.  * Include user defined options first. Anything not defined in these files
  43.  * will be set to standard values. Override anything you dont like!
  44.  */
  45. #include "lwipopts.h"
  46. #include "lwip/debug.h"
  47.  
  48. /*
  49.    -----------------------------------------------
  50.    ---------- Platform specific locking ----------
  51.    -----------------------------------------------
  52. */
  53.  
  54. /**
  55.  * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
  56.  * critical regions during buffer allocation, deallocation and memory
  57.  * allocation and deallocation.
  58.  */
  59. #define SYS_LIGHTWEIGHT_PROT            0
  60.  
  61. /**
  62.  * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  63.  * use lwIP facilities.
  64.  */
  65. #define NO_SYS                          0
  66.  
  67. /*
  68.    ------------------------------------
  69.    ---------- Memory options ----------
  70.    ------------------------------------
  71. */
  72.  
  73. /**
  74.  * MEM_ALIGNMENT: should be set to the alignment of the CPU
  75.  *    4 byte alignment -> #define MEM_ALIGNMENT 4
  76.  *    2 byte alignment -> #define MEM_ALIGNMENT 2
  77.  */
  78. #define MEM_ALIGNMENT                   4
  79.  
  80. /**
  81.  * MEM_SIZE: the size of the heap memory. If the application will send
  82.  * a lot of data that needs to be copied, this should be set high.
  83.  */
  84. #define MEM_SIZE                        1600
  85.  
  86. /*
  87.    ------------------------------------------------
  88.    ---------- Internal Memory Pool Sizes ----------
  89.    ------------------------------------------------
  90. */
  91. /**
  92.  * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
  93.  * If the application sends a lot of data out of ROM (or other static memory),
  94.  * this should be set high.
  95.  */
  96. #define MEMP_NUM_PBUF                   16
  97.  
  98. /**
  99.  * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
  100.  * (requires the LWIP_RAW option)
  101.  */
  102. #define MEMP_NUM_RAW_PCB                4
  103.  
  104. /**
  105.  * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  106.  * per active UDP "connection".
  107.  * (requires the LWIP_UDP option)
  108.  */
  109. #define MEMP_NUM_UDP_PCB                4
  110.  
  111. /**
  112.  * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
  113.  * (requires the LWIP_TCP option)
  114.  */
  115. #define MEMP_NUM_TCP_PCB                4
  116.  
  117. /**
  118.  * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
  119.  * (requires the LWIP_TCP option)
  120.  */
  121. #define MEMP_NUM_TCP_PCB_LISTEN         4
  122.  
  123. /**
  124.  * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
  125.  * (requires the LWIP_TCP option)
  126.  */
  127. #define MEMP_NUM_TCP_SEG                16
  128.  
  129. /**
  130.  * MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
  131.  * reassembly (whole packets, not fragments!)
  132.  */
  133. #define MEMP_NUM_REASSDATA              1
  134.  
  135. /**
  136.  * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
  137.  * packets (pbufs) that are waiting for an ARP request (to resolve
  138.  * their destination address) to finish.
  139.  * (requires the ARP_QUEUEING option)
  140.  */
  141. #define MEMP_NUM_ARP_QUEUE              2
  142.  
  143. /**
  144.  * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
  145.  * (requires NO_SYS==0)
  146.  */
  147. #define MEMP_NUM_SYS_TIMEOUT            5
  148.  
  149. /**
  150.  * MEMP_NUM_NETBUF: the number of struct netbufs.
  151.  * (only needed if you use the sequential API, like api_lib.c)
  152.  */
  153. #define MEMP_NUM_NETBUF                 2
  154.  
  155. /**
  156.  * MEMP_NUM_NETCONN: the number of struct netconns.
  157.  * (only needed if you use the sequential API, like api_lib.c)
  158.  */
  159. #define MEMP_NUM_NETCONN                4
  160.  
  161. /**
  162.  * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
  163.  * for callback/timeout API communication.
  164.  * (only needed if you use tcpip.c)
  165.  */
  166. #define MEMP_NUM_TCPIP_MSG_API          8
  167.  
  168. /**
  169.  * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
  170.  * for incoming packets.
  171.  * (only needed if you use tcpip.c)
  172.  */
  173. #define MEMP_NUM_TCPIP_MSG_INPKT        8
  174.  
  175. /**
  176.  * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
  177.  */
  178. #define PBUF_POOL_SIZE                  8
  179.  
  180. /*
  181.    ---------------------------------
  182.    ---------- ARP options ----------
  183.    ---------------------------------
  184. */
  185. /**
  186.  * LWIP_ARP==1: Enable ARP functionality.
  187.  */
  188. #define LWIP_ARP                        1
  189.  
  190. /*
  191.    --------------------------------
  192.    ---------- IP options ----------
  193.    --------------------------------
  194. */
  195. /**
  196.  * IP_FORWARD==1: Enables the ability to forward IP packets across network
  197.  * interfaces. If you are going to run lwIP on a device with only one network
  198.  * interface, define this to 0.
  199.  */
  200. #define IP_FORWARD                      0
  201.  
  202. /**
  203.  * IP_OPTIONS: Defines the behavior for IP options.
  204.  *      IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
  205.  *      IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
  206.  */
  207. #define IP_OPTIONS_ALLOWED              1
  208.  
  209. /**
  210.  * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
  211.  * this option does not affect outgoing packet sizes, which can be controlled
  212.  * via IP_FRAG.
  213.  */
  214. #define IP_REASSEMBLY                   1
  215.  
  216. /**
  217.  * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
  218.  * that this option does not affect incoming packet sizes, which can be
  219.  * controlled via IP_REASSEMBLY.
  220.  */
  221. #define IP_FRAG                         1
  222.  
  223. /**
  224.  * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
  225.  * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
  226.  * in this time, the whole packet is discarded.
  227.  */
  228. #define IP_REASS_MAXAGE                 3
  229.  
  230. /**
  231.  * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
  232.  * Since the received pbufs are enqueued, be sure to configure
  233.  * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
  234.  * packets even if the maximum amount of fragments is enqueued for reassembly!
  235.  */
  236. #define IP_REASS_MAX_PBUFS              4
  237.  
  238. /**
  239.  * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
  240.  * fragmentation. Otherwise pbufs are allocated and reference the original
  241.     * packet data to be fragmented.
  242. */
  243. #define IP_FRAG_USES_STATIC_BUF         0
  244.  
  245. /**
  246.  * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
  247.  */
  248. #define IP_DEFAULT_TTL                  255
  249.  
  250. /*
  251.    ----------------------------------
  252.    ---------- ICMP options ----------
  253.    ----------------------------------
  254. */
  255. /**
  256.  * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
  257.  * Be careful, disable that make your product non-compliant to RFC1122
  258.  */
  259. #define LWIP_ICMP                       1
  260.  
  261. /*
  262.    ---------------------------------
  263.    ---------- RAW options ----------
  264.    ---------------------------------
  265. */
  266. /**
  267.  * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
  268.  */
  269. #define LWIP_RAW                        1
  270.  
  271. /*
  272.    ----------------------------------
  273.    ---------- DHCP options ----------
  274.    ----------------------------------
  275. */
  276. /**
  277.  * LWIP_DHCP==1: Enable DHCP module.
  278.  */
  279. #define LWIP_DHCP                       0
  280.  
  281.  
  282. /*
  283.    ------------------------------------
  284.    ---------- AUTOIP options ----------
  285.    ------------------------------------
  286. */
  287. /**
  288.  * LWIP_AUTOIP==1: Enable AUTOIP module.
  289.  */
  290. #define LWIP_AUTOIP                     0
  291.  
  292. /*
  293.    ----------------------------------
  294.    ---------- SNMP options ----------
  295.    ----------------------------------
  296. */
  297. /**
  298.  * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
  299.  * transport.
  300.  */
  301. #define LWIP_SNMP                       0
  302.  
  303. /*
  304.    ----------------------------------
  305.    ---------- IGMP options ----------
  306.    ----------------------------------
  307. */
  308. /**
  309.  * LWIP_IGMP==1: Turn on IGMP module.
  310.  */
  311. #define LWIP_IGMP                       0
  312.  
  313. /*
  314.    ----------------------------------
  315.    ---------- DNS options -----------
  316.    ----------------------------------
  317. */
  318. /**
  319.  * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
  320.  * transport.
  321.  */
  322. #define LWIP_DNS                        0
  323.  
  324. /*
  325.    ---------------------------------
  326.    ---------- UDP options ----------
  327.    ---------------------------------
  328. */
  329. /**
  330.  * LWIP_UDP==1: Turn on UDP.
  331.  */
  332. #define LWIP_UDP                        1
  333.  
  334. /*
  335.    ---------------------------------
  336.    ---------- TCP options ----------
  337.    ---------------------------------
  338. */
  339. /**
  340.  * LWIP_TCP==1: Turn on TCP.
  341.  */
  342. #define LWIP_TCP                        1
  343.  
  344. #define LWIP_LISTEN_BACKLOG             0
  345.  
  346. /*
  347.    ----------------------------------
  348.    ---------- Pbuf options ----------
  349.    ----------------------------------
  350. */
  351. /**
  352.  * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  353.  * link level header. The default is 14, the standard value for
  354.  * Ethernet.
  355.  */
  356. #define PBUF_LINK_HLEN                  16
  357.  
  358. /**
  359.  * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
  360.  * designed to accomodate single full size TCP frame in one pbuf, including
  361.  * TCP_MSS, IP header, and link header.
  362. *
  363.  */
  364. #define PBUF_POOL_BUFSIZE               LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
  365.  
  366. /*
  367.    ------------------------------------
  368.    ---------- LOOPIF options ----------
  369.    ------------------------------------
  370. */
  371. /**
  372.  * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
  373.  */
  374. #define LWIP_HAVE_LOOPIF                0
  375.  
  376. /*
  377.    ----------------------------------------------
  378.    ---------- Sequential layer options ----------
  379.    ----------------------------------------------
  380. */
  381.  
  382. /**
  383.  * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  384.  */
  385. #define LWIP_NETCONN                    1
  386.  
  387. /*
  388.    ------------------------------------
  389.    ---------- Socket options ----------
  390.    ------------------------------------
  391. */
  392. /**
  393.  * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  394.  */
  395. #define LWIP_SOCKET                     1
  396.  
  397. /*
  398.    ----------------------------------------
  399.    ---------- Statistics options ----------
  400.    ----------------------------------------
  401. */
  402. /**
  403.  * LWIP_STATS==1: Enable statistics collection in lwip_stats.
  404.  */
  405. #define LWIP_STATS                      0
  406. /*
  407.    ---------------------------------
  408.    ---------- PPP options ----------
  409.    ---------------------------------
  410. */
  411. /**
  412.  * PPP_SUPPORT==1: Enable PPP.
  413.  */
  414. #define PPP_SUPPORT                     1
  415. #define PRINTPKT_SUPPORT 1
  416. #define PAP_SUPPORT 1
  417.  
  418. #define LWIP_DEBUG 1
  419. #define TCP_DEBUG 1
  420. #define PPP_DEBUG 1
  421.  
  422.  
  423.  
  424. /*--------------------------------------------------------*/
  425. /*--------------------------------------------------------*/
  426. /*          STM32 specific config                         */
  427. /*--------------------------------------------------------*/
  428. /*--------------------------------------------------------*/
  429.  
  430. /*----- Value in opt.h for RECV_BUFSIZE_DEFAULT: INT_MAX -----*/
  431. #define RECV_BUFSIZE_DEFAULT 2000000000
  432. /*----- Value in opt.h for TCP_SND_QUEUELEN: (4*TCP_SND_BUF + (TCP_MSS - 1))/TCP_MSS -----*/
  433. #define TCP_SND_QUEUELEN 9
  434. /*----- Value in opt.h for TCP_SNDLOWAT: LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) -*/
  435. #define TCP_SNDLOWAT 1071
  436. /*----- Value in opt.h for TCP_SNDQUEUELOWAT: LWIP_MAX(TCP_SND_QUEUELEN)/2, 5) -*/
  437. #define TCP_SNDQUEUELOWAT 5
  438. /*----- Value in opt.h for TCP_WND_UPDATE_THRESHOLD: LWIP_MIN(TCP_WND/4, TCP_MSS*4) -----*/
  439. #define TCP_WND_UPDATE_THRESHOLD 536
  440. /*----- Value in opt.h for TCPIP_THREAD_STACKSIZE: 0 -----*/
  441. #define TCPIP_THREAD_STACKSIZE 1024
  442. /*----- Value in opt.h for TCPIP_THREAD_PRIO: 1 -----*/
  443. #define TCPIP_THREAD_PRIO 3
  444. /*----- Value in opt.h for TCPIP_MBOX_SIZE: 0 -----*/
  445. #define TCPIP_MBOX_SIZE 6
  446. /*----- Value in opt.h for SLIPIF_THREAD_STACKSIZE: 0 -----*/
  447. #define SLIPIF_THREAD_STACKSIZE 1024
  448. /*----- Value in opt.h for SLIPIF_THREAD_PRIO: 1 -----*/
  449. #define SLIPIF_THREAD_PRIO 3
  450. /*----- Value in opt.h for DEFAULT_THREAD_STACKSIZE: 0 -----*/
  451. #define DEFAULT_THREAD_STACKSIZE 1024
  452. /*----- Value in opt.h for DEFAULT_THREAD_PRIO: 1 -----*/
  453. #define DEFAULT_THREAD_PRIO 3
  454. /*----- Value in opt.h for DEFAULT_TCP_RECVMBOX_SIZE: 0 -----*/
  455. #define DEFAULT_TCP_RECVMBOX_SIZE 6
  456.  
  457. /* Misc */
  458.  
  459. #endif /* LWIP_LWIPOPTS_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement