]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_LPC1768_GCC_RedSuite/src/webserver/uipopt.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / CORTEX_LPC1768_GCC_RedSuite / src / webserver / uipopt.h
1 /**\r
2  * \defgroup uipopt Configuration options for uIP\r
3  * @{\r
4  *\r
5  * uIP is configured using the per-project configuration file\r
6  * uipopt.h. This file contains all compile-time options for uIP and\r
7  * should be tweaked to match each specific project. The uIP\r
8  * distribution contains a documented example "uipopt.h" that can be\r
9  * copied and modified for each project.\r
10  *\r
11  * \note Most of the configuration options in the uipopt.h should not\r
12  * be changed, but rather the per-project uip-conf.h file.\r
13  */\r
14 \r
15 /**\r
16  * \file\r
17  * Configuration options for uIP.\r
18  * \author Adam Dunkels <adam@dunkels.com>\r
19  *\r
20  * This file is used for tweaking various configuration options for\r
21  * uIP. You should make a copy of this file into one of your project's\r
22  * directories instead of editing this example "uipopt.h" file that\r
23  * comes with the uIP distribution.\r
24  */\r
25 \r
26 /*\r
27  * Copyright (c) 2001-2003, Adam Dunkels.\r
28  * All rights reserved.\r
29  *\r
30  * Redistribution and use in source and binary forms, with or without\r
31  * modification, are permitted provided that the following conditions\r
32  * are met:\r
33  * 1. Redistributions of source code must retain the above copyright\r
34  *    notice, this list of conditions and the following disclaimer.\r
35  * 2. Redistributions in binary form must reproduce the above copyright\r
36  *    notice, this list of conditions and the following disclaimer in the\r
37  *    documentation and/or other materials provided with the distribution.\r
38  * 3. The name of the author may not be used to endorse or promote\r
39  *    products derived from this software without specific prior\r
40  *    written permission.\r
41  *\r
42  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
43  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
44  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
45  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
46  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
47  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
48  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
49  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
50  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
51  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
52  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
53  *\r
54  * This file is part of the uIP TCP/IP stack.\r
55  *\r
56  * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $\r
57  *\r
58  */\r
59 \r
60 #ifndef __UIPOPT_H__\r
61 #define __UIPOPT_H__\r
62 \r
63 #ifndef UIP_LITTLE_ENDIAN\r
64 #define UIP_LITTLE_ENDIAN  3412\r
65 #endif /* UIP_LITTLE_ENDIAN */\r
66 #ifndef UIP_BIG_ENDIAN\r
67 #define UIP_BIG_ENDIAN     1234\r
68 #endif /* UIP_BIG_ENDIAN */\r
69 \r
70 #include "uip-conf.h"\r
71 \r
72 /*------------------------------------------------------------------------------*/\r
73 \r
74 /**\r
75  * \name Static configuration options\r
76  * @{\r
77  *\r
78  * These configuration options can be used for setting the IP address\r
79  * settings statically, but only if UIP_FIXEDADDR is set to 1. The\r
80  * configuration options for a specific node includes IP address,\r
81  * netmask and default router as well as the Ethernet address. The\r
82  * netmask, default router and Ethernet address are appliciable only\r
83  * if uIP should be run over Ethernet.\r
84  *\r
85  * All of these should be changed to suit your project.\r
86 */\r
87 \r
88 /**\r
89  * Determines if uIP should use a fixed IP address or not.\r
90  *\r
91  * If uIP should use a fixed IP address, the settings are set in the\r
92  * uipopt.h file. If not, the macros uip_sethostaddr(),\r
93  * uip_setdraddr() and uip_setnetmask() should be used instead.\r
94  *\r
95  * \hideinitializer\r
96  */\r
97 #define UIP_FIXEDADDR    0\r
98 \r
99 /**\r
100  * Ping IP address asignment.\r
101  *\r
102  * uIP uses a "ping" packets for setting its own IP address if this\r
103  * option is set. If so, uIP will start with an empty IP address and\r
104  * the destination IP address of the first incoming "ping" (ICMP echo)\r
105  * packet will be used for setting the hosts IP address.\r
106  *\r
107  * \note This works only if UIP_FIXEDADDR is 0.\r
108  *\r
109  * \hideinitializer\r
110  */\r
111 #ifdef UIP_CONF_PINGADDRCONF\r
112 #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF\r
113 #else /* UIP_CONF_PINGADDRCONF */\r
114 #define UIP_PINGADDRCONF 0\r
115 #endif /* UIP_CONF_PINGADDRCONF */\r
116 \r
117 \r
118 /**\r
119  * Specifies if the uIP ARP module should be compiled with a fixed\r
120  * Ethernet MAC address or not.\r
121  *\r
122  * If this configuration option is 0, the macro uip_setethaddr() can\r
123  * be used to specify the Ethernet address at run-time.\r
124  *\r
125  * \hideinitializer\r
126  */\r
127 #define UIP_FIXEDETHADDR 0\r
128 \r
129 /** @} */\r
130 /*------------------------------------------------------------------------------*/\r
131 /**\r
132  * \name IP configuration options\r
133  * @{\r
134  *\r
135  */\r
136 /**\r
137  * The IP TTL (time to live) of IP packets sent by uIP.\r
138  *\r
139  * This should normally not be changed.\r
140  */\r
141 #define UIP_TTL         64\r
142 \r
143 /**\r
144  * Turn on support for IP packet reassembly.\r
145  *\r
146  * uIP supports reassembly of fragmented IP packets. This features\r
147  * requires an additonal amount of RAM to hold the reassembly buffer\r
148  * and the reassembly code size is approximately 700 bytes.  The\r
149  * reassembly buffer is of the same size as the uip_buf buffer\r
150  * (configured by UIP_BUFSIZE).\r
151  *\r
152  * \note IP packet reassembly is not heavily tested.\r
153  *\r
154  * \hideinitializer\r
155  */\r
156 #define UIP_REASSEMBLY 0\r
157 \r
158 /**\r
159  * The maximum time an IP fragment should wait in the reassembly\r
160  * buffer before it is dropped.\r
161  *\r
162  */\r
163 #define UIP_REASS_MAXAGE 40\r
164 \r
165 /** @} */\r
166 \r
167 /*------------------------------------------------------------------------------*/\r
168 /**\r
169  * \name UDP configuration options\r
170  * @{\r
171  */\r
172 \r
173 /**\r
174  * Toggles wether UDP support should be compiled in or not.\r
175  *\r
176  * \hideinitializer\r
177  */\r
178 #ifdef UIP_CONF_UDP\r
179 #define UIP_UDP UIP_CONF_UDP\r
180 #else /* UIP_CONF_UDP */\r
181 #define UIP_UDP           0\r
182 #endif /* UIP_CONF_UDP */\r
183 \r
184 /**\r
185  * Toggles if UDP checksums should be used or not.\r
186  *\r
187  * \note Support for UDP checksums is currently not included in uIP,\r
188  * so this option has no function.\r
189  *\r
190  * \hideinitializer\r
191  */\r
192 #ifdef UIP_CONF_UDP_CHECKSUMS\r
193 #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS\r
194 #else\r
195 #define UIP_UDP_CHECKSUMS 0\r
196 #endif\r
197 \r
198 /**\r
199  * The maximum amount of concurrent UDP connections.\r
200  *\r
201  * \hideinitializer\r
202  */\r
203 #ifdef UIP_CONF_UDP_CONNS\r
204 #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS\r
205 #else /* UIP_CONF_UDP_CONNS */\r
206 #define UIP_UDP_CONNS    10\r
207 #endif /* UIP_CONF_UDP_CONNS */\r
208 \r
209 /**\r
210  * The name of the function that should be called when UDP datagrams arrive.\r
211  *\r
212  * \hideinitializer\r
213  */\r
214 \r
215 \r
216 /** @} */\r
217 /*------------------------------------------------------------------------------*/\r
218 /**\r
219  * \name TCP configuration options\r
220  * @{\r
221  */\r
222 \r
223 /**\r
224  * Determines if support for opening connections from uIP should be\r
225  * compiled in.\r
226  *\r
227  * If the applications that are running on top of uIP for this project\r
228  * do not need to open outgoing TCP connections, this configration\r
229  * option can be turned off to reduce the code size of uIP.\r
230  *\r
231  * \hideinitializer\r
232  */\r
233 #define UIP_ACTIVE_OPEN 1\r
234 \r
235 /**\r
236  * The maximum number of simultaneously open TCP connections.\r
237  *\r
238  * Since the TCP connections are statically allocated, turning this\r
239  * configuration knob down results in less RAM used. Each TCP\r
240  * connection requires approximatly 30 bytes of memory.\r
241  *\r
242  * \hideinitializer\r
243  */\r
244 #ifndef UIP_CONF_MAX_CONNECTIONS\r
245 #define UIP_CONNS       10\r
246 #else /* UIP_CONF_MAX_CONNECTIONS */\r
247 #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS\r
248 #endif /* UIP_CONF_MAX_CONNECTIONS */\r
249 \r
250 \r
251 /**\r
252  * The maximum number of simultaneously listening TCP ports.\r
253  *\r
254  * Each listening TCP port requires 2 bytes of memory.\r
255  *\r
256  * \hideinitializer\r
257  */\r
258 #ifndef UIP_CONF_MAX_LISTENPORTS\r
259 #define UIP_LISTENPORTS 20\r
260 #else /* UIP_CONF_MAX_LISTENPORTS */\r
261 #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS\r
262 #endif /* UIP_CONF_MAX_LISTENPORTS */\r
263 \r
264 /**\r
265  * Determines if support for TCP urgent data notification should be\r
266  * compiled in.\r
267  *\r
268  * Urgent data (out-of-band data) is a rarely used TCP feature that\r
269  * very seldom would be required.\r
270  *\r
271  * \hideinitializer\r
272  */\r
273 #define UIP_URGDATA      0\r
274 \r
275 /**\r
276  * The initial retransmission timeout counted in timer pulses.\r
277  *\r
278  * This should not be changed.\r
279  */\r
280 #define UIP_RTO         3\r
281 \r
282 /**\r
283  * The maximum number of times a segment should be retransmitted\r
284  * before the connection should be aborted.\r
285  *\r
286  * This should not be changed.\r
287  */\r
288 #define UIP_MAXRTX      8\r
289 \r
290 /**\r
291  * The maximum number of times a SYN segment should be retransmitted\r
292  * before a connection request should be deemed to have been\r
293  * unsuccessful.\r
294  *\r
295  * This should not need to be changed.\r
296  */\r
297 #define UIP_MAXSYNRTX      5\r
298 \r
299 /**\r
300  * The TCP maximum segment size.\r
301  *\r
302  * This is should not be to set to more than\r
303  * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.\r
304  */\r
305 #define UIP_TCP_MSS     (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)\r
306 \r
307 /**\r
308  * The size of the advertised receiver's window.\r
309  *\r
310  * Should be set low (i.e., to the size of the uip_buf buffer) is the\r
311  * application is slow to process incoming data, or high (32768 bytes)\r
312  * if the application processes data quickly.\r
313  *\r
314  * \hideinitializer\r
315  */\r
316 #ifndef UIP_CONF_RECEIVE_WINDOW\r
317 #define UIP_RECEIVE_WINDOW UIP_TCP_MSS\r
318 #else\r
319 #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW\r
320 #endif\r
321 \r
322 /**\r
323  * How long a connection should stay in the TIME_WAIT state.\r
324  *\r
325  * This configiration option has no real implication, and it should be\r
326  * left untouched.\r
327  */\r
328 #define UIP_TIME_WAIT_TIMEOUT 120\r
329 \r
330 \r
331 /** @} */\r
332 /*------------------------------------------------------------------------------*/\r
333 /**\r
334  * \name ARP configuration options\r
335  * @{\r
336  */\r
337 \r
338 /**\r
339  * The size of the ARP table.\r
340  *\r
341  * This option should be set to a larger value if this uIP node will\r
342  * have many connections from the local network.\r
343  *\r
344  * \hideinitializer\r
345  */\r
346 #ifdef UIP_CONF_ARPTAB_SIZE\r
347 #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE\r
348 #else\r
349 #define UIP_ARPTAB_SIZE 8\r
350 #endif\r
351 \r
352 /**\r
353  * The maxium age of ARP table entries measured in 10ths of seconds.\r
354  *\r
355  * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD\r
356  * default).\r
357  */\r
358 #define UIP_ARP_MAXAGE 120\r
359 \r
360 /** @} */\r
361 \r
362 /*------------------------------------------------------------------------------*/\r
363 \r
364 /**\r
365  * \name General configuration options\r
366  * @{\r
367  */\r
368 \r
369 /**\r
370  * The size of the uIP packet buffer.\r
371  *\r
372  * The uIP packet buffer should not be smaller than 60 bytes, and does\r
373  * not need to be larger than 1500 bytes. Lower size results in lower\r
374  * TCP throughput, larger size results in higher TCP throughput.\r
375  *\r
376  * \hideinitializer\r
377  */\r
378 #ifndef UIP_CONF_BUFFER_SIZE\r
379 #define UIP_BUFSIZE     1500\r
380 #else /* UIP_CONF_BUFFER_SIZE */\r
381 #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE\r
382 #endif /* UIP_CONF_BUFFER_SIZE */\r
383 \r
384 \r
385 /**\r
386  * Determines if statistics support should be compiled in.\r
387  *\r
388  * The statistics is useful for debugging and to show the user.\r
389  *\r
390  * \hideinitializer\r
391  */\r
392 #ifndef UIP_CONF_STATISTICS\r
393 #define UIP_STATISTICS  0\r
394 #else /* UIP_CONF_STATISTICS */\r
395 #define UIP_STATISTICS UIP_CONF_STATISTICS\r
396 #endif /* UIP_CONF_STATISTICS */\r
397 \r
398 /**\r
399  * Determines if logging of certain events should be compiled in.\r
400  *\r
401  * This is useful mostly for debugging. The function uip_log()\r
402  * must be implemented to suit the architecture of the project, if\r
403  * logging is turned on.\r
404  *\r
405  * \hideinitializer\r
406  */\r
407 #ifndef UIP_CONF_LOGGING\r
408 #define UIP_LOGGING     0\r
409 #else /* UIP_CONF_LOGGING */\r
410 #define UIP_LOGGING     UIP_CONF_LOGGING\r
411 #endif /* UIP_CONF_LOGGING */\r
412 \r
413 /**\r
414  * Broadcast support.\r
415  *\r
416  * This flag configures IP broadcast support. This is useful only\r
417  * together with UDP.\r
418  *\r
419  * \hideinitializer\r
420  *\r
421  */\r
422 #ifndef UIP_CONF_BROADCAST\r
423 #define UIP_BROADCAST 0\r
424 #else /* UIP_CONF_BROADCAST */\r
425 #define UIP_BROADCAST UIP_CONF_BROADCAST\r
426 #endif /* UIP_CONF_BROADCAST */\r
427 \r
428 /**\r
429  * Print out a uIP log message.\r
430  *\r
431  * This function must be implemented by the module that uses uIP, and\r
432  * is called by uIP whenever a log message is generated.\r
433  */\r
434 void uip_log(char *msg);\r
435 \r
436 /**\r
437  * The link level header length.\r
438  *\r
439  * This is the offset into the uip_buf where the IP header can be\r
440  * found. For Ethernet, this should be set to 14. For SLIP, this\r
441  * should be set to 0.\r
442  *\r
443  * \hideinitializer\r
444  */\r
445 #ifdef UIP_CONF_LLH_LEN\r
446 #define UIP_LLH_LEN UIP_CONF_LLH_LEN\r
447 #else /* UIP_CONF_LLH_LEN */\r
448 #define UIP_LLH_LEN     14\r
449 #endif /* UIP_CONF_LLH_LEN */\r
450 \r
451 /** @} */\r
452 /*------------------------------------------------------------------------------*/\r
453 /**\r
454  * \name CPU architecture configuration\r
455  * @{\r
456  *\r
457  * The CPU architecture configuration is where the endianess of the\r
458  * CPU on which uIP is to be run is specified. Most CPUs today are\r
459  * little endian, and the most notable exception are the Motorolas\r
460  * which are big endian. The BYTE_ORDER macro should be changed to\r
461  * reflect the CPU architecture on which uIP is to be run.\r
462  */\r
463 \r
464 /**\r
465  * The byte order of the CPU architecture on which uIP is to be run.\r
466  *\r
467  * This option can be either BIG_ENDIAN (Motorola byte order) or\r
468  * LITTLE_ENDIAN (Intel byte order).\r
469  *\r
470  * \hideinitializer\r
471  */\r
472 #ifdef UIP_CONF_BYTE_ORDER\r
473 #define UIP_BYTE_ORDER     UIP_CONF_BYTE_ORDER\r
474 #else /* UIP_CONF_BYTE_ORDER */\r
475 #define UIP_BYTE_ORDER     UIP_LITTLE_ENDIAN\r
476 #endif /* UIP_CONF_BYTE_ORDER */\r
477 \r
478 /** @} */\r
479 /*------------------------------------------------------------------------------*/\r
480 \r
481 /**\r
482  * \name Appication specific configurations\r
483  * @{\r
484  *\r
485  * An uIP application is implemented using a single application\r
486  * function that is called by uIP whenever a TCP/IP event occurs. The\r
487  * name of this function must be registered with uIP at compile time\r
488  * using the UIP_APPCALL definition.\r
489  *\r
490  * uIP applications can store the application state within the\r
491  * uip_conn structure by specifying the type of the application\r
492  * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.\r
493  *\r
494  * The file containing the definitions must be included in the\r
495  * uipopt.h file.\r
496  *\r
497  * The following example illustrates how this can look.\r
498  \code\r
499 \r
500 void httpd_appcall(void);\r
501 #define UIP_APPCALL     httpd_appcall\r
502 \r
503 struct httpd_state {\r
504   u8_t state;\r
505   u16_t count;\r
506   char *dataptr;\r
507   char *script;\r
508 };\r
509 typedef struct httpd_state uip_tcp_appstate_t\r
510  \endcode\r
511  */\r
512 \r
513 /**\r
514  * \var #define UIP_APPCALL\r
515  *\r
516  * The name of the application function that uIP should call in\r
517  * response to TCP/IP events.\r
518  *\r
519  */\r
520 \r
521 /**\r
522  * \var typedef uip_tcp_appstate_t\r
523  *\r
524  * The type of the application state that is to be stored in the\r
525  * uip_conn structure. This usually is typedef:ed to a struct holding\r
526  * application state information.\r
527  */\r
528 \r
529 /**\r
530  * \var typedef uip_udp_appstate_t\r
531  *\r
532  * The type of the application state that is to be stored in the\r
533  * uip_conn structure. This usually is typedef:ed to a struct holding\r
534  * application state information.\r
535  */\r
536 /** @} */\r
537 /** @} */\r
538 \r
539 #endif /* __UIPOPT_H__ */\r