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