2 * \defgroup uipopt Configuration options for uIP
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.
14 * Configuration options for uIP.
15 * \author Adam Dunkels <adam@dunkels.com>
17 * This file is used for tweaking various configuration options for
18 * uIP. You should make a copy of this file into one of your project's
19 * directories instead of editing this example "uipopt.h" file that
20 * comes with the uIP distribution.
24 * Copyright (c) 2001-2003, Adam Dunkels.
25 * All rights reserved.
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. The name of the author may not be used to endorse or promote
36 * products derived from this software without specific prior
39 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
40 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
43 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
45 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
47 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
49 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 * This file is part of the uIP TCP/IP stack.
63 /*------------------------------------------------------------------------------*/
65 * \defgroup uipopttypedef uIP type definitions
70 * The 8-bit unsigned data type.
72 * This may have to be tweaked for your particular compiler. "unsigned
73 * char" works for most compilers.
78 * The 8-bit signed data type.
80 * This may have to be tweaked for your particular compiler. "unsigned
81 * char" works for most compilers.
86 * The 16-bit unsigned data type.
88 * This may have to be tweaked for your particular compiler. "unsigned
89 * short" works for most compilers.
94 * The 16-bit signed data type.
96 * This may have to be tweaked for your particular compiler. "unsigned
97 * short" works for most compilers.
102 * The 32-bit signed data type.
104 * This may have to be tweaked for your particular compiler. "unsigned
105 * short" works for most compilers.
110 * The 32-bit unsigned data type.
112 * This may have to be tweaked for your particular compiler. "unsigned
113 * short" works for most compilers.
118 * The statistics data type.
120 * This datatype determines how high the statistics counters are able
123 typedef u16 uip_stats_t
;
126 /*------------------------------------------------------------------------------*/
128 * \defgroup uipoptip IP configuration options
133 * The IP TTL (time to live) of IP packets sent by uIP.
135 * This should normally not be changed.
137 #define UIP_TCP_TTL 255
142 * Turn on support for IP packet reassembly.
144 * uIP supports reassembly of fragmented IP packets. This features
145 * requires an additonal amount of RAM to hold the reassembly buffer
146 * and the reassembly code size is approximately 700 bytes. The
147 * reassembly buffer is of the same size as the uip_buf buffer
148 * (configured by UIP_BUFSIZE).
150 * \note IP packet reassembly is not heavily tested.
154 #define UIP_IP_REASSEMBLY 0
156 #define UIP_IP_FRAG 0
159 * The maximum time an IP fragment should wait in the reassembly
160 * buffer before it is dropped.
163 #define UIP_REASS_MAXAGE 30
167 /*------------------------------------------------------------------------------*/
169 * \defgroup uipoptudp UDP configuration options
172 * \note The UDP support in uIP is still not entirely complete; there
173 * is no support for sending or receiving broadcast or multicast
174 * packets, but it works well enough to support a number of vital
175 * applications such as DNS queries, though
179 * Toggles wether UDP support should be compiled in or not.
186 * Toggles if UDP checksums should be used or not.
188 * \note Support for UDP checksums is currently not included in uIP,
189 * so this option has no function.
193 #define UIP_UDP_CHECKSUMS 0
196 * The maximum amount of concurrent UDP connections.
200 #define UIP_UDP_CONNS 10
203 * The name of the function that should be called when UDP datagrams arrive.
207 //#define UIP_UDP_APPCALL ((void*0)
210 /*------------------------------------------------------------------------------*/
212 * \defgroup uipopttcp TCP configuration options
217 * Determines if support for opening connections from uIP should be
220 * If the applications that are running on top of uIP for this project
221 * do not need to open outgoing TCP connections, this configration
222 * option can be turned off to reduce the code size of uIP.
226 #define UIP_ACTIVE_OPEN 1
229 * The maximum number of simultaneously open TCP connections.
231 * Since the TCP connections are statically allocated, turning this
232 * configuration knob down results in less RAM used. Each TCP
233 * connection requires approximatly 30 bytes of memory.
237 #define UIP_TCP_PCBS 4
240 * The maximum number of simultaneously listening TCP ports.
242 * Each listening TCP port requires 2 bytes of memory.
246 #define UIP_LISTEN_TCP_PCBS 2
249 * The size of the advertised receiver's window.
251 * Should be set low (i.e., to the size of the uip_buf buffer) is the
252 * application is slow to process incoming data, or high (32768 bytes)
253 * if the application processes data quickly.
257 #define UIP_TCPIP_SOCKS 32
259 #define UIP_TCP_SEGS 32
263 * Determines if support for TCP urgent data notification should be
266 * Urgent data (out-of-band data) is a rarely used TCP feature that
267 * very seldom would be required.
271 #define UIP_URGDATA 1
274 * The initial retransmission timeout counted in timer pulses.
276 * This should not be changed.
281 * The maximum number of times a segment should be retransmitted
282 * before the connection should be aborted.
284 * This should not be changed.
286 #define UIP_MAXRTX 12
289 * The maximum number of times a SYN segment should be retransmitted
290 * before a connection request should be deemed to have been
293 * This should not need to be changed.
295 #define UIP_MAXSYNRTX 4
298 * The TCP maximum segment size.
300 * This is should not be to set to more than UIP_BUFSIZE - UIP_LLH_LEN - 40.
302 #define UIP_TCP_MSS (1460)
305 #define UIP_TCP_SND_BUF (4*UIP_TCP_MSS)
307 #define UIP_TCP_SND_QUEUELEN (4*UIP_TCP_SND_BUF/UIP_TCP_MSS)
309 #define UIP_TCP_WND (4*UIP_TCP_MSS)
312 * How long a connection should stay in the TIME_WAIT state.
314 * This configiration option has no real implication, and it should be
317 #define UIP_TIME_WAIT_TIMEOUT 120
321 /*------------------------------------------------------------------------------*/
323 * \defgroup uipoptarp ARP configuration options
328 * The size of the ARP table.
330 * This option should be set to a larger value if this uIP node will
331 * have many connections from the local network.
335 #define UIP_ARPTAB_SIZE 8
338 * The maxium age of ARP table entries measured in 10ths of seconds.
340 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
343 #define UIP_ARP_MAXAGE 120
347 /*------------------------------------------------------------------------------*/
350 * \defgroup uipoptgeneral General configuration options
355 * The size of the uIP packet buffer.
357 * The uIP packet buffer should not be smaller than 60 bytes, and does
358 * not need to be larger than 1500 bytes. Lower size results in lower
359 * TCP throughput, larger size results in higher TCP throughput.
363 #define UIP_MEM_SIZE (28*1024)
365 #define UIP_PBUF_POOL_NUM 16
366 #define UIP_PBUF_POOL_BUFSIZE 1600
368 #define UIP_PBUF_ROM_NUM 128
372 * Determines if statistics support should be compiled in.
374 * The statistics is useful for debugging and to show the user.
378 #define UIP_STATISTICS 0
381 * Determines if logging of certain events should be compiled in.
383 * This is useful mostly for debugging. The function uip_log()
384 * must be implemented to suit the architecture of the project, if
385 * logging is turned on.
389 #define UIP_LOGGING 0
390 #define UIP_ERRORING 0
393 * Print out a uIP log message.
395 * This function must be implemented by the module that uses uIP, and
396 * is called by uIP whenever a log message is generated.
398 void uip_log(const char *filename
,int line_nb
,char *msg
);
401 * The link level header length.
403 * This is the offset into the uip_buf where the IP header can be
404 * found. For Ethernet, this should be set to 14. For SLIP, this
405 * should be set to 0.
409 #define UIP_LL_HLEN 16
411 #define UIP_TCPIP_HLEN 40
413 /*------------------------------------------------------------------------------*/
415 * \defgroup uipoptcpu CPU architecture configuration
418 * The CPU architecture configuration is where the endianess of the
419 * CPU on which uIP is to be run is specified. Most CPUs today are
420 * little endian, and the most notable exception are the Motorolas
421 * which are big endian. The BYTE_ORDER macro should be changed to
422 * reflect the CPU architecture on which uIP is to be run.
424 #ifndef LITTLE_ENDIAN
425 #define LITTLE_ENDIAN 3412
426 #endif /* LITTLE_ENDIAN */
428 #define BIG_ENDIAN 1234
429 #endif /* BIGE_ENDIAN */
432 * The byte order of the CPU architecture on which uIP is to be run.
434 * This option can be either BIG_ENDIAN (Motorola byte order) or
435 * LITTLE_ENDIAN (Intel byte order).
440 #define BYTE_ORDER BIG_ENDIAN
441 #endif /* BYTE_ORDER */
444 /*------------------------------------------------------------------------------*/
447 * \defgroup uipoptapp Appication specific configurations
450 * An uIP application is implemented using a single application
451 * function that is called by uIP whenever a TCP/IP event occurs. The
452 * name of this function must be registered with uIP at compile time
453 * using the UIP_APPCALL definition.
455 * uIP applications can store the application state within the
456 * uip_conn structure by specifying the size of the application
457 * structure with the UIP_APPSTATE_SIZE macro.
459 * The file containing the definitions must be included in the
462 * The following example illustrates how this can look.
465 void httpd_appcall(void);
466 #define UIP_APPCALL httpd_appcall
474 #define UIP_APPSTATE_SIZE (sizeof(struct httpd_state))
479 * \var #define UIP_APPCALL
481 * The name of the application function that uIP should call in
482 * response to TCP/IP events.
487 * \var #define UIP_APPSTATE_SIZE
489 * The size of the application state that is to be stored in the
490 * uip_conn structure.
494 /* Include the header file for the application program that should be
495 used. If you don't use the example web server, you should change
498 #define UIP_LIBC_MEMFUNCREPLACE 1
500 #endif /* __UIPOPT_H__ */