]> git.sur5r.net Git - freertos/blob - Demo/uIP_Demo_Rowley_ARM7/uip/uipopt.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / uIP_Demo_Rowley_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 #if 0\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     202U  /**< 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    255 /**< 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 \r
161 #define UIP_DRIPADDR0   192 /**< The first octet of the IP address of\r
162                                the default router, if UIP_FIXEDADDR is\r
163                                1. \hideinitializer */\r
164 #define UIP_DRIPADDR1   168 /**< The second octet of the IP address of\r
165                                the default router, if UIP_FIXEDADDR is\r
166                                1. \hideinitializer */\r
167 #define UIP_DRIPADDR2   0   /**< The third octet of the IP address of\r
168                                the default router, if UIP_FIXEDADDR is\r
169                                1. \hideinitializer */\r
170 #define UIP_DRIPADDR3   1   /**< The fourth octet of the IP address of\r
171                                the default router, if UIP_FIXEDADDR is\r
172                                1. \hideinitializer */\r
173 \r
174 #else\r
175 \r
176 #define UIP_IPADDR0     172U  /**< The first octet of the IP address of\r
177                                this uIP node, if UIP_FIXEDADDR is\r
178                                1. \hideinitializer */\r
179 #define UIP_IPADDR1     25U /**< The second octet of the IP address of\r
180                                this uIP node, if UIP_FIXEDADDR is\r
181                                1. \hideinitializer */\r
182 #define UIP_IPADDR2     218U   /**< The third octet of the IP address of\r
183                                this uIP node, if UIP_FIXEDADDR is\r
184                                1. \hideinitializer */\r
185 #define UIP_IPADDR3     202U  /**< The fourth octet of the IP address of\r
186                                this uIP node, if UIP_FIXEDADDR is\r
187                                1. \hideinitializer */\r
188 \r
189 #define UIP_NETMASK0    255 /**< The first octet of the netmask of\r
190                                this uIP node, if UIP_FIXEDADDR is\r
191                                1. \hideinitializer */\r
192 #define UIP_NETMASK1    255 /**< The second octet of the netmask of\r
193                                this uIP node, if UIP_FIXEDADDR is\r
194                                1. \hideinitializer */\r
195 #define UIP_NETMASK2    255 /**< The third octet of the netmask of\r
196                                this uIP node, if UIP_FIXEDADDR is\r
197                                1. \hideinitializer */\r
198 #define UIP_NETMASK3    0   /**< The fourth octet of the netmask of\r
199                                this uIP node, if UIP_FIXEDADDR is\r
200                                1. \hideinitializer */\r
201 \r
202 #define UIP_DRIPADDR0   172 /**< The first octet of the IP address of\r
203                                the default router, if UIP_FIXEDADDR is\r
204                                1. \hideinitializer */\r
205 #define UIP_DRIPADDR1   25 /**< The second octet of the IP address of\r
206                                the default router, if UIP_FIXEDADDR is\r
207                                1. \hideinitializer */\r
208 #define UIP_DRIPADDR2   218   /**< The third octet of the IP address of\r
209                                the default router, if UIP_FIXEDADDR is\r
210                                1. \hideinitializer */\r
211 #define UIP_DRIPADDR3   3   /**< The fourth octet of the IP address of\r
212                                the default router, if UIP_FIXEDADDR is\r
213                                1. \hideinitializer */\r
214 \r
215 #endif\r
216 \r
217 /**\r
218  * Specifies if the uIP ARP module should be compiled with a fixed\r
219  * Ethernet MAC address or not.\r
220  *\r
221  * If this configuration option is 0, the macro uip_setethaddr() can\r
222  * be used to specify the Ethernet address at run-time.\r
223  *\r
224  * \hideinitializer\r
225  */\r
226 #define UIP_FIXEDETHADDR 0\r
227 \r
228 #define UIP_ETHADDR0    0x00  /**< The first octet of the Ethernet\r
229                                  address if UIP_FIXEDETHADDR is\r
230                                  1. \hideinitializer */\r
231 #define UIP_ETHADDR1    0xbd  /**< The second octet of the Ethernet\r
232                                  address if UIP_FIXEDETHADDR is\r
233                                  1. \hideinitializer */\r
234 #define UIP_ETHADDR2    0x3b  /**< The third octet of the Ethernet\r
235                                  address if UIP_FIXEDETHADDR is\r
236                                  1. \hideinitializer */\r
237 #define UIP_ETHADDR3    0x33  /**< The fourth octet of the Ethernet\r
238                                  address if UIP_FIXEDETHADDR is\r
239                                  1. \hideinitializer */\r
240 #define UIP_ETHADDR4    0x05  /**< The fifth octet of the Ethernet\r
241                                  address if UIP_FIXEDETHADDR is\r
242                                  1. \hideinitializer */\r
243 #define UIP_ETHADDR5    0x71  /**< The sixth octet of the Ethernet\r
244                                  address if UIP_FIXEDETHADDR is\r
245                                  1. \hideinitializer */\r
246 \r
247 /** @} */\r
248 /*------------------------------------------------------------------------------*/\r
249 /**\r
250  * \defgroup uipoptip IP configuration options\r
251  * @{\r
252  *\r
253  */\r
254 /**\r
255  * The IP TTL (time to live) of IP packets sent by uIP.\r
256  *\r
257  * This should normally not be changed.\r
258  */\r
259 #define UIP_TTL         255\r
260 \r
261 /**\r
262  * Turn on support for IP packet reassembly.\r
263  *\r
264  * uIP supports reassembly of fragmented IP packets. This features\r
265  * requires an additonal amount of RAM to hold the reassembly buffer\r
266  * and the reassembly code size is approximately 700 bytes.  The\r
267  * reassembly buffer is of the same size as the uip_buf buffer\r
268  * (configured by UIP_BUFSIZE).\r
269  *\r
270  * \note IP packet reassembly is not heavily tested.\r
271  *\r
272  * \hideinitializer\r
273  */\r
274 #define UIP_REASSEMBLY 0\r
275 \r
276 /**\r
277  * The maximum time an IP fragment should wait in the reassembly\r
278  * buffer before it is dropped.\r
279  *\r
280  */\r
281 #define UIP_REASS_MAXAGE 40\r
282 \r
283 /** @} */\r
284 \r
285 /*------------------------------------------------------------------------------*/\r
286 /**\r
287  * \defgroup uipoptudp UDP configuration options\r
288  * @{\r
289  *\r
290  * \note The UDP support in uIP is still not entirely complete; there\r
291  * is no support for sending or receiving broadcast or multicast\r
292  * packets, but it works well enough to support a number of vital\r
293  * applications such as DNS queries, though\r
294  */\r
295 \r
296 /**\r
297  * Toggles wether UDP support should be compiled in or not.\r
298  *\r
299  * \hideinitializer\r
300  */\r
301 #define UIP_UDP           0\r
302 \r
303 /**\r
304  * Toggles if UDP checksums should be used or not.\r
305  *\r
306  * \note Support for UDP checksums is currently not included in uIP,\r
307  * so this option has no function.\r
308  *\r
309  * \hideinitializer\r
310  */\r
311 #define UIP_UDP_CHECKSUMS 0\r
312 \r
313 /**\r
314  * The maximum amount of concurrent UDP connections.\r
315  *\r
316  * \hideinitializer\r
317  */\r
318 #define UIP_UDP_CONNS    2\r
319 \r
320 /**\r
321  * The name of the function that should be called when UDP datagrams arrive.\r
322  *\r
323  * \hideinitializer\r
324  */\r
325 #define UIP_UDP_APPCALL  udp_appcall\r
326 \r
327 /** @} */\r
328 /*------------------------------------------------------------------------------*/\r
329 /**\r
330  * \defgroup uipopttcp TCP configuration options\r
331  * @{\r
332  */\r
333 \r
334 /**\r
335  * Determines if support for opening connections from uIP should be\r
336  * compiled in.\r
337  *\r
338  * If the applications that are running on top of uIP for this project\r
339  * do not need to open outgoing TCP connections, this configration\r
340  * option can be turned off to reduce the code size of uIP.\r
341  *\r
342  * \hideinitializer\r
343  */\r
344 #define UIP_ACTIVE_OPEN 1\r
345 \r
346 /**\r
347  * The maximum number of simultaneously open TCP connections.\r
348  *\r
349  * Since the TCP connections are statically allocated, turning this\r
350  * configuration knob down results in less RAM used. Each TCP\r
351  * connection requires approximatly 30 bytes of memory.\r
352  *\r
353  * \hideinitializer\r
354  */\r
355 #define UIP_CONNS       20\r
356 \r
357 /**\r
358  * The maximum number of simultaneously listening TCP ports.\r
359  *\r
360  * Each listening TCP port requires 2 bytes of memory.\r
361  *\r
362  * \hideinitializer\r
363  */\r
364 #define UIP_LISTENPORTS 10\r
365 \r
366 /**\r
367  * The size of the advertised receiver's window.\r
368  *\r
369  * Should be set low (i.e., to the size of the uip_buf buffer) is the\r
370  * application is slow to process incoming data, or high (32768 bytes)\r
371  * if the application processes data quickly.\r
372  *\r
373  * \hideinitializer\r
374  */\r
375 #define UIP_RECEIVE_WINDOW   32768\r
376 \r
377 /**\r
378  * Determines if support for TCP urgent data notification should be\r
379  * compiled in.\r
380  *\r
381  * Urgent data (out-of-band data) is a rarely used TCP feature that\r
382  * very seldom would be required.\r
383  *\r
384  * \hideinitializer\r
385  */\r
386 #define UIP_URGDATA      1\r
387 \r
388 /**\r
389  * The initial retransmission timeout counted in timer pulses.\r
390  *\r
391  * This should not be changed.\r
392  */\r
393 #define UIP_RTO         3\r
394 \r
395 /**\r
396  * The maximum number of times a segment should be retransmitted\r
397  * before the connection should be aborted.\r
398  *\r
399  * This should not be changed.\r
400  */\r
401 #define UIP_MAXRTX      8\r
402 \r
403 /**\r
404  * The maximum number of times a SYN segment should be retransmitted\r
405  * before a connection request should be deemed to have been\r
406  * unsuccessful.\r
407  *\r
408  * This should not need to be changed.\r
409  */\r
410 #define UIP_MAXSYNRTX      3\r
411 \r
412 /**\r
413  * The TCP maximum segment size.\r
414  *\r
415  * This is should not be to set to more than UIP_BUFSIZE - UIP_LLH_LEN - 40.\r
416  */\r
417 #define UIP_TCP_MSS     (UIP_BUFSIZE - UIP_LLH_LEN - 40)\r
418 \r
419 /**\r
420  * How long a connection should stay in the TIME_WAIT state.\r
421  *\r
422  * This configiration option has no real implication, and it should be\r
423  * left untouched.\r
424  */ \r
425 #define UIP_TIME_WAIT_TIMEOUT 120\r
426 \r
427 \r
428 /** @} */\r
429 /*------------------------------------------------------------------------------*/\r
430 /**\r
431  * \defgroup uipoptarp ARP configuration options\r
432  * @{\r
433  */\r
434 \r
435 /**\r
436  * The size of the ARP table.\r
437  *\r
438  * This option should be set to a larger value if this uIP node will\r
439  * have many connections from the local network.\r
440  *\r
441  * \hideinitializer\r
442  */\r
443 #define UIP_ARPTAB_SIZE 8\r
444 \r
445 /**\r
446  * The maxium age of ARP table entries measured in 10ths of seconds.\r
447  *\r
448  * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD\r
449  * default).\r
450  */\r
451 #define UIP_ARP_MAXAGE 120\r
452 \r
453 /** @} */\r
454 \r
455 /*------------------------------------------------------------------------------*/\r
456 \r
457 /**\r
458  * \defgroup uipoptgeneral General configuration options\r
459  * @{\r
460  */\r
461 \r
462 /**\r
463  * The size of the uIP packet buffer.\r
464  *\r
465  * The uIP packet buffer should not be smaller than 60 bytes, and does\r
466  * not need to be larger than 1500 bytes. Lower size results in lower\r
467  * TCP throughput, larger size results in higher TCP throughput.\r
468  *\r
469  * \hideinitializer\r
470  */\r
471 #define UIP_BUFSIZE     2048\r
472 \r
473 \r
474 /**\r
475  * Determines if statistics support should be compiled in.\r
476  *\r
477  * The statistics is useful for debugging and to show the user.\r
478  *\r
479  * \hideinitializer\r
480  */\r
481 #define UIP_STATISTICS  1\r
482 \r
483 /**\r
484  * Determines if logging of certain events should be compiled in.\r
485  *\r
486  * This is useful mostly for debugging. The function uip_log()\r
487  * must be implemented to suit the architecture of the project, if\r
488  * logging is turned on.\r
489  *\r
490  * \hideinitializer\r
491  */\r
492 #define UIP_LOGGING 0\r
493 \r
494 /**\r
495  * Print out a uIP log message.\r
496  *\r
497  * This function must be implemented by the module that uses uIP, and\r
498  * is called by uIP whenever a log message is generated.\r
499  */\r
500 void uip_log(char *msg);\r
501 \r
502 /**\r
503  * The link level header length.\r
504  *\r
505  * This is the offset into the uip_buf where the IP header can be\r
506  * found. For Ethernet, this should be set to 14. For SLIP, this\r
507  * should be set to 0.\r
508  *\r
509  * \hideinitializer\r
510  */\r
511 #define UIP_LLH_LEN     14\r
512 \r
513 \r
514 /** @} */\r
515 /*------------------------------------------------------------------------------*/\r
516 /**\r
517  * \defgroup uipoptcpu CPU architecture configuration\r
518  * @{\r
519  *\r
520  * The CPU architecture configuration is where the endianess of the\r
521  * CPU on which uIP is to be run is specified. Most CPUs today are\r
522  * little endian, and the most notable exception are the Motorolas\r
523  * which are big endian. The BYTE_ORDER macro should be changed to\r
524  * reflect the CPU architecture on which uIP is to be run.\r
525  */\r
526 #ifndef LITTLE_ENDIAN\r
527 #define LITTLE_ENDIAN  3412\r
528 #endif /* LITTLE_ENDIAN */\r
529 #ifndef BIG_ENDIAN\r
530 #define BIG_ENDIAN     1234\r
531 #endif /* BIGE_ENDIAN */\r
532 \r
533 /**\r
534  * The byte order of the CPU architecture on which uIP is to be run.\r
535  *\r
536  * This option can be either BIG_ENDIAN (Motorola byte order) or\r
537  * LITTLE_ENDIAN (Intel byte order).\r
538  *\r
539  * \hideinitializer\r
540  */\r
541 #ifndef BYTE_ORDER\r
542 #define BYTE_ORDER     LITTLE_ENDIAN\r
543 #endif /* BYTE_ORDER */\r
544 \r
545 /** @} */\r
546 /*------------------------------------------------------------------------------*/\r
547 \r
548 /**\r
549  * \defgroup uipoptapp Appication specific configurations\r
550  * @{\r
551  *\r
552  * An uIP application is implemented using a single application\r
553  * function that is called by uIP whenever a TCP/IP event occurs. The\r
554  * name of this function must be registered with uIP at compile time\r
555  * using the UIP_APPCALL definition.\r
556  *\r
557  * uIP applications can store the application state within the\r
558  * uip_conn structure by specifying the size of the application\r
559  * structure with the UIP_APPSTATE_SIZE macro.\r
560  *\r
561  * The file containing the definitions must be included in the\r
562  * uipopt.h file.\r
563  *\r
564  * The following example illustrates how this can look.\r
565  \code\r
566 \r
567 void httpd_appcall(void);\r
568 #define UIP_APPCALL     httpd_appcall\r
569 \r
570 struct httpd_state {\r
571   u8_t state; \r
572   u16_t count;\r
573   char *dataptr;\r
574   char *script;\r
575 };\r
576 #define UIP_APPSTATE_SIZE (sizeof(struct httpd_state))\r
577  \endcode\r
578  */\r
579 \r
580 /**\r
581  * \var #define UIP_APPCALL\r
582  *\r
583  * The name of the application function that uIP should call in\r
584  * response to TCP/IP events.\r
585  *\r
586  */\r
587 \r
588 /**\r
589  * \var #define UIP_APPSTATE_SIZE\r
590  *\r
591  * The size of the application state that is to be stored in the\r
592  * uip_conn structure.\r
593  */\r
594 /** @} */\r
595 \r
596 /* Include the header file for the application program that should be\r
597    used. If you don't use the example web server, you should change\r
598    this. */\r
599 #include "httpd.h"\r
600 \r
601 \r
602 #endif /* __UIPOPT_H__ */\r