root/webserver/example/freeRTOS/Demo/Common/ethernet/uIP/uip-1.0/uip/uipopt.h

Revision 14, 14.6 kB (checked in by phil, 15 years ago)

added unmodified FreeRTOS package V5.4.1 with only web srv demo source for LPC2368 for CrossWorks?

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