• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 Joan Lled� <jlledom@member.fsf.org>
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  *    this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright notice,
10  *    this list of conditions and the following disclaimer in the documentation
11  *    and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  *    derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
16  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
18  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
20  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
24  * OF SUCH DAMAGE.
25  */
26 
27 #ifndef UNIX_LWIP_LWIPOPTS_H
28 #define UNIX_LWIP_LWIPOPTS_H
29 
30 /* An OS is present */
31 #define NO_SYS    0
32 
33 /* Sockets API config */
34 #define LWIP_COMPAT_SOCKETS       0
35 #define LWIP_SOCKET_OFFSET        1
36 #define LWIP_POLL                 1
37 
38 /* User posix socket headers */
39 #define LWIP_SOCKET_EXTERNAL_HEADERS            1
40 #define LWIP_SOCKET_EXTERNAL_HEADER_SOCKETS_H   "posix/sockets.h"
41 #define LWIP_SOCKET_EXTERNAL_HEADER_INET_H      "posix/inet.h"
42 #define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS   1
43 
44 /* Use Glibc malloc()/free() */
45 #define MEM_LIBC_MALLOC   1
46 #define MEMP_MEM_MALLOC   1
47 #define MEM_USE_POOLS     0
48 
49 /* Only send complete packets to the device */
50 #define LWIP_NETIF_TX_SINGLE_PBUF 1
51 
52 /* Randomize local ports */
53 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS  1
54 
55 /* Glibc sends more than one packet in a row during an ARP resolution */
56 #define ARP_QUEUEING    1
57 #define ARP_QUEUE_LEN   10
58 
59 /*
60  * Activate loopback, but don't use lwip's default loopback interface,
61  * we provide our own.
62  */
63 #define LWIP_NETIF_LOOPBACK   1
64 #define LWIP_HAVE_LOOPIF      0
65 
66 /* IPv4 stuff */
67 #define IP_FORWARD  1
68 
69 /* SLAAC support and other IPv6 stuff */
70 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
71 #define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
72 #define LWIP_IPV6_AUTOCONFIG          1
73 #define LWIP_IPV6_FORWARD             1
74 #define MEMP_NUM_MLD6_GROUP           16
75 #define LWIP_IPV6_NUM_ADDRESSES       6
76 #define IPV6_FRAG_COPYHEADER          1
77 
78 /* TCP tuning */
79 #define TCP_MSS         1460
80 #define TCP_WND         0xFFFF
81 #define LWIP_WND_SCALE  1
82 #define TCP_RCV_SCALE   0x1
83 #define TCP_SND_BUF     TCP_WND
84 
85 /* Throughput settings */
86 #define LWIP_CHECKSUM_ON_COPY   1
87 
88 /* Disable stats */
89 #define LWIP_STATS          0
90 #define LWIP_STATS_DISPLAY  0
91 
92 /* Enable all socket operations */
93 #define LWIP_TCP_KEEPALIVE          1
94 #define LWIP_SO_SNDTIMEO            1
95 #define LWIP_SO_RCVTIMEO            1
96 #define LWIP_SO_RCVBUF              1
97 #define LWIP_SO_LINGER              1
98 #define SO_REUSE                    1
99 #define LWIP_MULTICAST_TX_OPTIONS   1
100 
101 /* Enable modules */
102 #define LWIP_ARP              1
103 #define LWIP_ETHERNET         1
104 #define LWIP_IPV4             1
105 #define LWIP_ICMP             1
106 #define LWIP_IGMP             1
107 #define LWIP_RAW              1
108 #define LWIP_UDP              1
109 #define LWIP_UDPLITE          1
110 #define LWIP_TCP              1
111 #define LWIP_IPV6             1
112 #define LWIP_ICMP6            1
113 #define LWIP_IPV6_MLD         1
114 
115 /* Don't abort the whole stack when an error is detected */
116 #define LWIP_NOASSERT_ON_ERROR   1
117 
118 /* Threading options */
119 #define LWIP_TCPIP_CORE_LOCKING   1
120 
121 /* If the system is 64 bit */
122 #if defined __LP64__
123 #define MEM_ALIGNMENT            8
124 #else
125 #define MEM_ALIGNMENT            4
126 #endif
127 
128 #if !NO_SYS
129 void sys_check_core_locking(void);
130 #define LWIP_ASSERT_CORE_LOCKED()  sys_check_core_locking()
131 #if 0
132 void sys_mark_tcpip_thread(void);
133 #define LWIP_MARK_TCPIP_THREAD()   sys_mark_tcpip_thread()
134 
135 #if LWIP_TCPIP_CORE_LOCKING
136 void sys_lock_tcpip_core(void);
137 #define LOCK_TCPIP_CORE()          sys_lock_tcpip_core()
138 void sys_unlock_tcpip_core(void);
139 #define UNLOCK_TCPIP_CORE()        sys_unlock_tcpip_core()
140 #endif
141 #endif
142 #endif
143 
144 /* Debug mode */
145 #ifdef LWIP_DEBUG
146 #define ETHARP_DEBUG      LWIP_DBG_OFF
147 #define NETIF_DEBUG       LWIP_DBG_OFF
148 #define PBUF_DEBUG        LWIP_DBG_OFF
149 #define API_LIB_DEBUG     LWIP_DBG_OFF
150 #define API_MSG_DEBUG     LWIP_DBG_OFF
151 #define SOCKETS_DEBUG     LWIP_DBG_OFF
152 #define ICMP_DEBUG        LWIP_DBG_OFF
153 #define IGMP_DEBUG        LWIP_DBG_OFF
154 #define INET_DEBUG        LWIP_DBG_OFF
155 #define IP_DEBUG          LWIP_DBG_OFF
156 #define IP_REASS_DEBUG    LWIP_DBG_OFF
157 #define RAW_DEBUG         LWIP_DBG_OFF
158 #define MEM_DEBUG         LWIP_DBG_OFF
159 #define MEMP_DEBUG        LWIP_DBG_OFF
160 #define SYS_DEBUG         LWIP_DBG_OFF
161 #define TIMERS_DEBUG      LWIP_DBG_OFF
162 #define TCP_DEBUG         LWIP_DBG_OFF
163 #define TCP_INPUT_DEBUG   LWIP_DBG_OFF
164 #define TCP_FR_DEBUG      LWIP_DBG_OFF
165 #define TCP_RTO_DEBUG     LWIP_DBG_OFF
166 #define TCP_CWND_DEBUG    LWIP_DBG_OFF
167 #define TCP_WND_DEBUG     LWIP_DBG_OFF
168 #define TCP_OUTPUT_DEBUG  LWIP_DBG_OFF
169 #define TCP_RST_DEBUG     LWIP_DBG_OFF
170 #define TCP_QLEN_DEBUG    LWIP_DBG_OFF
171 #define UDP_DEBUG         LWIP_DBG_OFF
172 #define TCPIP_DEBUG       LWIP_DBG_OFF
173 #define SLIP_DEBUG        LWIP_DBG_OFF
174 #define DHCP_DEBUG        LWIP_DBG_OFF
175 #define AUTOIP_DEBUG      LWIP_DBG_OFF
176 #define DNS_DEBUG         LWIP_DBG_OFF
177 #define IP6_DEBUG         LWIP_DBG_OFF
178 #endif
179 
180 #endif /* UNIX_LWIP_LWIPOPTS_H */
181