2 * \defgroup uipopt Configuration options for uIP
\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
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
17 * Configuration options for uIP.
\r
18 * \author Adam Dunkels <adam@dunkels.com>
\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
27 * Copyright (c) 2001-2003, Adam Dunkels.
\r
28 * All rights reserved.
\r
30 * Redistribution and use in source and binary forms, with or without
\r
31 * modification, are permitted provided that the following conditions
\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
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
54 * This file is part of the uIP TCP/IP stack.
\r
56 * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $
\r
60 #ifndef __UIPOPT_H__
\r
61 #define __UIPOPT_H__
\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
70 #include "uip-conf.h"
\r
72 /*------------------------------------------------------------------------------*/
\r
75 * \name Static configuration options
\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
85 * All of these should be changed to suit your project.
\r
89 * Determines if uIP should use a fixed IP address or not.
\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
97 #define UIP_FIXEDADDR 0
\r
100 * Ping IP address asignment.
\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
107 * \note This works only if UIP_FIXEDADDR is 0.
\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
119 * Specifies if the uIP ARP module should be compiled with a fixed
\r
120 * Ethernet MAC address or not.
\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
127 #define UIP_FIXEDETHADDR 0
\r
130 /*------------------------------------------------------------------------------*/
\r
132 * \name IP configuration options
\r
137 * The IP TTL (time to live) of IP packets sent by uIP.
\r
139 * This should normally not be changed.
\r
144 * Turn on support for IP packet reassembly.
\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
152 * \note IP packet reassembly is not heavily tested.
\r
156 #define UIP_REASSEMBLY 0
\r
159 * The maximum time an IP fragment should wait in the reassembly
\r
160 * buffer before it is dropped.
\r
163 #define UIP_REASS_MAXAGE 40
\r
167 /*------------------------------------------------------------------------------*/
\r
169 * \name UDP configuration options
\r
174 * Toggles wether UDP support should be compiled in or not.
\r
178 #ifdef UIP_CONF_UDP
\r
179 #define UIP_UDP UIP_CONF_UDP
\r
180 #else /* UIP_CONF_UDP */
\r
182 #endif /* UIP_CONF_UDP */
\r
185 * Toggles if UDP checksums should be used or not.
\r
187 * \note Support for UDP checksums is currently not included in uIP,
\r
188 * so this option has no function.
\r
192 #ifdef UIP_CONF_UDP_CHECKSUMS
\r
193 #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
\r
195 #define UIP_UDP_CHECKSUMS 0
\r
199 * The maximum amount of concurrent UDP connections.
\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
210 * The name of the function that should be called when UDP datagrams arrive.
\r
217 /*------------------------------------------------------------------------------*/
\r
219 * \name TCP configuration options
\r
224 * Determines if support for opening connections from uIP should be
\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
233 #define UIP_ACTIVE_OPEN 1
\r
236 * The maximum number of simultaneously open TCP connections.
\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
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
252 * The maximum number of simultaneously listening TCP ports.
\r
254 * Each listening TCP port requires 2 bytes of memory.
\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
265 * Determines if support for TCP urgent data notification should be
\r
268 * Urgent data (out-of-band data) is a rarely used TCP feature that
\r
269 * very seldom would be required.
\r
273 #define UIP_URGDATA 0
\r
276 * The initial retransmission timeout counted in timer pulses.
\r
278 * This should not be changed.
\r
283 * The maximum number of times a segment should be retransmitted
\r
284 * before the connection should be aborted.
\r
286 * This should not be changed.
\r
288 #define UIP_MAXRTX 8
\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
295 * This should not need to be changed.
\r
297 #define UIP_MAXSYNRTX 5
\r
300 * The TCP maximum segment size.
\r
302 * This is should not be to set to more than
\r
303 * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
\r
305 #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
\r
308 * The size of the advertised receiver's window.
\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
316 #ifndef UIP_CONF_RECEIVE_WINDOW
\r
317 #define UIP_RECEIVE_WINDOW UIP_TCP_MSS
\r
319 #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
\r
323 * How long a connection should stay in the TIME_WAIT state.
\r
325 * This configiration option has no real implication, and it should be
\r
328 #define UIP_TIME_WAIT_TIMEOUT 120
\r
332 /*------------------------------------------------------------------------------*/
\r
334 * \name ARP configuration options
\r
339 * The size of the ARP table.
\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
346 #ifdef UIP_CONF_ARPTAB_SIZE
\r
347 #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
\r
349 #define UIP_ARPTAB_SIZE 8
\r
353 * The maxium age of ARP table entries measured in 10ths of seconds.
\r
355 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
\r
358 #define UIP_ARP_MAXAGE 120
\r
362 /*------------------------------------------------------------------------------*/
\r
365 * \name General configuration options
\r
370 * The size of the uIP packet buffer.
\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
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
386 * Determines if statistics support should be compiled in.
\r
388 * The statistics is useful for debugging and to show the user.
\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
399 * Determines if logging of certain events should be compiled in.
\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
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
414 * Broadcast support.
\r
416 * This flag configures IP broadcast support. This is useful only
\r
417 * together with UDP.
\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
429 * Print out a uIP log message.
\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
434 void uip_log(char *msg);
\r
437 * The link level header length.
\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
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
452 /*------------------------------------------------------------------------------*/
\r
454 * \name CPU architecture configuration
\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
465 * The byte order of the CPU architecture on which uIP is to be run.
\r
467 * This option can be either BIG_ENDIAN (Motorola byte order) or
\r
468 * LITTLE_ENDIAN (Intel byte order).
\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
479 /*------------------------------------------------------------------------------*/
\r
482 * \name Appication specific configurations
\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
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
494 * The file containing the definitions must be included in the
\r
497 * The following example illustrates how this can look.
\r
500 void httpd_appcall(void);
\r
501 #define UIP_APPCALL httpd_appcall
\r
503 struct httpd_state {
\r
509 typedef struct httpd_state uip_tcp_appstate_t
\r
514 * \var #define UIP_APPCALL
\r
516 * The name of the application function that uIP should call in
\r
517 * response to TCP/IP events.
\r
522 * \var typedef uip_tcp_appstate_t
\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
530 * \var typedef uip_udp_appstate_t
\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
539 #endif /* __UIPOPT_H__ */
\r