-
Notifications
You must be signed in to change notification settings - Fork 0
/
lwipopts.h
236 lines (153 loc) · 5.94 KB
/
lwipopts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/* lwIP configuration for Pico HTTPS example **********************************
* *
* Configuration for the lwIP network library included in the Pico SDK and *
* required for the Pico HTTPS example. *
* *
* N.b. Not all options are strictly required; this is just an example *
* configuration. *
* *
* https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html *
* https://github.com/lwip-tcpip/lwip/blob/master/src/include/lwip/opt.h *
* *
******************************************************************************/
#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H
#define _LWIPOPTS_EXAMPLE_COMMONH_H
/* System options *************************************************************/
// Run without OS
//
// No OS on Pico W platform
//
#define NO_SYS 1
/* Memory options *************************************************************/
// Disable native C-library malloc
//
// Incompatible with `pico_cyw43_arch_lwip_threadsafe_background`
//
#define MEM_LIBC_MALLOC 0
// Byte alignment
#define MEM_ALIGNMENT 4 // bytes
// Heap size
#define MEM_SIZE 4000 // bytes
/* Memory pool options ********************************************************/
// Max queued ARP packets
#define MEMP_NUM_ARP_QUEUE 10
//
// Max queued TCP segments
#define MEMP_NUM_TCP_SEG 32
/* ARP options ****************************************************************/
// Enable ARP support
//
// Required for IP layer of network stack
//
#define LWIP_ARP 1
/* ICMP options ***************************************************************/
// Enable ICMP support
//
// Probably required for IP layer of network stack?
//
#define LWIP_ICMP 1
/* IP options *****************************************************************/
// Enable IPv4 support
#define LWIP_IPV4 1
/* DHCP options ***************************************************************/
// Enable DHCP support
//
// Required for connecting to wireless network
//
#define LWIP_DHCP 1
// Disable address conflict detection
#define LWIP_DHCP_DOES_ACD_CHECK 0
// Disable ARP check
#define DHCP_DOES_ARP_CHECK 0
/* DNS options ****************************************************************/
// Enable DNS support
//
// Required for hostname resolution
//
#define LWIP_DNS 1
/* UDP options ****************************************************************/
// Enable UDP support
//
// Probably required for DNS queries?
//
#define LWIP_UDP 1
/* TCP options ****************************************************************/
// Enable TCP support
#define LWIP_TCP 1
// Max segment size
#define TCP_MSS 1460
// Window size
#define TCP_WND (8 * TCP_MSS)
// Send buffer size
#define TCP_SND_BUF (8 * TCP_MSS)
// Send queue length
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
// TCP options
#define LWIP_TCP_KEEPALIVE 1
/* ALTCP options **************************************************************/
// Enable ALTCP support
//
// ALTCP is lwIP interface for TCP + X. In the case of the Pico HTTPS example,
// X should be TLS, as required for HTTPS.
//
#define LWIP_ALTCP 1
// Enable ALTCP-compatible TLS interface
//
// i.e. Set X to TLS in ALTCP = TCP + X
//
#define LWIP_ALTCP_TLS 1
// Enable ALTCP-compatible TLS interface
//
// A port of the Mbed-TLS library is included in lwIP. __N.b. this is not a
// full MbedTLS distribution__, but rather simply provides an lwIP compatible
// interface to Mbed-TLS.
//
#define LWIP_ALTCP_TLS_MBEDTLS 1
/* Mbed-TLS options ***********************************************************/
// Require TLS authentication (certificate)
//
// Cause ignoring certificate errors leads to bad things…
//
#define ALTCP_MBEDTLS_AUTHMODE MBEDTLS_SSL_VERIFY_REQUIRED
/* Network interface options **************************************************/
// Disable NETIF API support
//
// Not needed. Sequential API, and therefore for platforms with OSes only.
//
#define LWIP_NETIF_API 0
// Set interface name from hostname
#define LWIP_NETIF_HOSTNAME 1
// Enable callback on interface state change
#define LWIP_NETIF_STATUS_CALLBACK 1
// Enable callback on link state change
#define LWIP_NETIF_LINK_CALLBACK 1
// Try to put all TX data in single pbuf
#define LWIP_NETIF_TX_SINGLE_PBUF 1
/* Sequntial API options ******************************************************/
// Disable socket support
//
// Not needed. Sequential API, and therefore for platforms with OSes only.
//
#define LWIP_SOCKET 0
// Disable netconn support
//
// Not needed. Sequential API, and therefore for platforms with OSes only.
//
#define LWIP_NETCONN 0
/* Statistics options *********************************************************/
// Enable statistics
#define LWIP_STATS 1
// Enable statistics display function
#define LWIP_STATS_DISPLAY 1
// Enable memory stats
#define MEM_STATS 1
// Disable system stats
#define SYS_STATS 0
// Disable memory pool stats
#define MEMP_STATS 0
// Disable link stats
#define LINK_STATS 0
/* Debug options **************************************************************/
// Enable debugging
#define LWIP_DEBUG 1
#endif //_LWIPOPTS_EXAMPLE_COMMONH_H