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
14 * Configuration options for uIP.
\r
15 * \author Adam Dunkels <adam@dunkels.com>
\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
24 * Copyright (c) 2001-2003, Adam Dunkels.
\r
25 * All rights reserved.
\r
27 * Redistribution and use in source and binary forms, with or without
\r
28 * modification, are permitted provided that the following conditions
\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
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
51 * This file is part of the uIP TCP/IP stack.
\r
53 * $Id: uipopt.h,v 1.16.2.5 2003/10/07 13:22:51 adam Exp $
\r
57 #ifndef __UIPOPT_H__
\r
58 #define __UIPOPT_H__
\r
60 /*------------------------------------------------------------------------------*/
\r
62 * \defgroup uipopttypedef uIP type definitions
\r
67 * The 8-bit unsigned data type.
\r
69 * This may have to be tweaked for your particular compiler. "unsigned
\r
70 * char" works for most compilers.
\r
72 typedef unsigned char u8_t;
\r
75 * The 16-bit unsigned data type.
\r
77 * This may have to be tweaked for your particular compiler. "unsigned
\r
78 * short" works for most compilers.
\r
80 typedef unsigned short u16_t;
\r
83 * The statistics data type.
\r
85 * This datatype determines how high the statistics counters are able
\r
88 typedef unsigned short uip_stats_t;
\r
92 /*------------------------------------------------------------------------------*/
\r
95 * \defgroup uipoptstaticconf Static configuration options
\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
105 * All of these should be changed to suit your project.
\r
109 * Determines if uIP should use a fixed IP address or not.
\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
117 #define UIP_FIXEDADDR 1
\r
120 * Ping IP address asignment.
\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
127 * \note This works only if UIP_FIXEDADDR is 0.
\r
131 #define UIP_PINGADDRCONF 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
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
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
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
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
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
218 * Specifies if the uIP ARP module should be compiled with a fixed
\r
219 * Ethernet MAC address or not.
\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
226 #define UIP_FIXEDETHADDR 0
\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
248 /*------------------------------------------------------------------------------*/
\r
250 * \defgroup uipoptip IP configuration options
\r
255 * The IP TTL (time to live) of IP packets sent by uIP.
\r
257 * This should normally not be changed.
\r
259 #define UIP_TTL 255
\r
262 * Turn on support for IP packet reassembly.
\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
270 * \note IP packet reassembly is not heavily tested.
\r
274 #define UIP_REASSEMBLY 0
\r
277 * The maximum time an IP fragment should wait in the reassembly
\r
278 * buffer before it is dropped.
\r
281 #define UIP_REASS_MAXAGE 40
\r
285 /*------------------------------------------------------------------------------*/
\r
287 * \defgroup uipoptudp UDP configuration options
\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
297 * Toggles wether UDP support should be compiled in or not.
\r
304 * Toggles if UDP checksums should be used or not.
\r
306 * \note Support for UDP checksums is currently not included in uIP,
\r
307 * so this option has no function.
\r
311 #define UIP_UDP_CHECKSUMS 0
\r
314 * The maximum amount of concurrent UDP connections.
\r
318 #define UIP_UDP_CONNS 2
\r
321 * The name of the function that should be called when UDP datagrams arrive.
\r
325 #define UIP_UDP_APPCALL udp_appcall
\r
328 /*------------------------------------------------------------------------------*/
\r
330 * \defgroup uipopttcp TCP configuration options
\r
335 * Determines if support for opening connections from uIP should be
\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
344 #define UIP_ACTIVE_OPEN 1
\r
347 * The maximum number of simultaneously open TCP connections.
\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
355 #define UIP_CONNS 20
\r
358 * The maximum number of simultaneously listening TCP ports.
\r
360 * Each listening TCP port requires 2 bytes of memory.
\r
364 #define UIP_LISTENPORTS 10
\r
367 * The size of the advertised receiver's window.
\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
375 #define UIP_RECEIVE_WINDOW 32768
\r
378 * Determines if support for TCP urgent data notification should be
\r
381 * Urgent data (out-of-band data) is a rarely used TCP feature that
\r
382 * very seldom would be required.
\r
386 #define UIP_URGDATA 1
\r
389 * The initial retransmission timeout counted in timer pulses.
\r
391 * This should not be changed.
\r
396 * The maximum number of times a segment should be retransmitted
\r
397 * before the connection should be aborted.
\r
399 * This should not be changed.
\r
401 #define UIP_MAXRTX 8
\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
408 * This should not need to be changed.
\r
410 #define UIP_MAXSYNRTX 3
\r
413 * The TCP maximum segment size.
\r
415 * This is should not be to set to more than UIP_BUFSIZE - UIP_LLH_LEN - 40.
\r
417 #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - 40)
\r
420 * How long a connection should stay in the TIME_WAIT state.
\r
422 * This configiration option has no real implication, and it should be
\r
425 #define UIP_TIME_WAIT_TIMEOUT 120
\r
429 /*------------------------------------------------------------------------------*/
\r
431 * \defgroup uipoptarp ARP configuration options
\r
436 * The size of the ARP table.
\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
443 #define UIP_ARPTAB_SIZE 8
\r
446 * The maxium age of ARP table entries measured in 10ths of seconds.
\r
448 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
\r
451 #define UIP_ARP_MAXAGE 120
\r
455 /*------------------------------------------------------------------------------*/
\r
458 * \defgroup uipoptgeneral General configuration options
\r
463 * The size of the uIP packet buffer.
\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
471 #define UIP_BUFSIZE 2048
\r
475 * Determines if statistics support should be compiled in.
\r
477 * The statistics is useful for debugging and to show the user.
\r
481 #define UIP_STATISTICS 1
\r
484 * Determines if logging of certain events should be compiled in.
\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
492 #define UIP_LOGGING 0
\r
495 * Print out a uIP log message.
\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
500 void uip_log(char *msg);
\r
503 * The link level header length.
\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
511 #define UIP_LLH_LEN 14
\r
515 /*------------------------------------------------------------------------------*/
\r
517 * \defgroup uipoptcpu CPU architecture configuration
\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
526 #ifndef LITTLE_ENDIAN
\r
527 #define LITTLE_ENDIAN 3412
\r
528 #endif /* LITTLE_ENDIAN */
\r
530 #define BIG_ENDIAN 1234
\r
531 #endif /* BIGE_ENDIAN */
\r
534 * The byte order of the CPU architecture on which uIP is to be run.
\r
536 * This option can be either BIG_ENDIAN (Motorola byte order) or
\r
537 * LITTLE_ENDIAN (Intel byte order).
\r
542 #define BYTE_ORDER LITTLE_ENDIAN
\r
543 #endif /* BYTE_ORDER */
\r
546 /*------------------------------------------------------------------------------*/
\r
549 * \defgroup uipoptapp Appication specific configurations
\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
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
561 * The file containing the definitions must be included in the
\r
564 * The following example illustrates how this can look.
\r
567 void httpd_appcall(void);
\r
568 #define UIP_APPCALL httpd_appcall
\r
570 struct httpd_state {
\r
576 #define UIP_APPSTATE_SIZE (sizeof(struct httpd_state))
\r
581 * \var #define UIP_APPCALL
\r
583 * The name of the application function that uIP should call in
\r
584 * response to TCP/IP events.
\r
589 * \var #define UIP_APPSTATE_SIZE
\r
591 * The size of the application state that is to be stored in the
\r
592 * uip_conn structure.
\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
602 #endif /* __UIPOPT_H__ */
\r