blob: 1ebe07166feddb09963660ec96f72bdf22fd80aa [file] [log] [blame]
adamdunkels2f5291c2003-04-09 12:55:06 +00001/*
2 * Copyright (c) 2001, Adam Dunkels.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Adam Dunkels.
16 * 4. The name of the author may not be used to endorse or promote
17 * products derived from this software without specific prior
18 * written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
21 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * This file is part of the uIP TCP/IP stack.
33 *
oliverschmidt648593b2005-02-23 22:43:53 +000034 * $Id: uipopt.h,v 1.2 2005/02/23 22:43:53 oliverschmidt Exp $
adamdunkels2f5291c2003-04-09 12:55:06 +000035 *
36 */
37
38#ifndef __UIPOPT_H__
39#define __UIPOPT_H__
40
41/* This file is used for tweaking various configuration options for
42 uIP. You should make a copy of this file into one of your project's
43 directories instead of editing this example "uipopt.h" file that
44 comes with the uIP distribution. */
45
46/*-----------------------------------------------------------------------------------*/
47/* First, two typedefs that may have to be tweaked for your particular
48 compiler. The uX_t types are unsigned integer types, where the X is
49 the number of bits in the integer type. Most compilers use
50 "unsigned char" and "unsigned short" for those two,
51 respectively. */
52typedef unsigned char u8_t;
53typedef unsigned short u16_t;
54typedef unsigned long u32_t;
55typedef unsigned long uip_stats_t;
56
57#include <string.h>
58#define bcopy(s,d,l) memcpy(d,s,l)
59
60/*-----------------------------------------------------------------------------------*/
61/* The configuration options for a specific node. This includes IP
62 * address, netmask and default router as well as the Ethernet
63 * address. The netmask, default router and Ethernet address are
64 * appliciable only if uIP should be run over Ethernet.
65 *
66 * All of these should be changed to suit your project.
67*/
68#define UIP_URGDATA 0
69#define UIP_PINGADDRCONF 0
70
71#define UIP_UDP 1
72#define UIP_UDP_CHECKSUMS 0
73#define UIP_UDP_CONNS 1
74#define UIP_UDP_APPCALL udp_appcall
75void udp_appcall(void);
76
77#define UIP_FIXEDADDR 0
78/* UIP_IPADDR: The IP address of this uIP node. */
79/*#define UIP_IPADDR0 192
80#define UIP_IPADDR1 168
81#define UIP_IPADDR2 0
82#define UIP_IPADDR3 2*/
83
84/* UIP_NETMASK: The netmask. */
85#define UIP_NETMASK0 255
86#define UIP_NETMASK1 255
87#define UIP_NETMASK2 255
88#define UIP_NETMASK3 0
89
90/* UIP_DRIPADDR: IP address of the default router. */
91#define UIP_DRIPADDR0 192
92#define UIP_DRIPADDR1 168
93#define UIP_DRIPADDR2 1
94#define UIP_DRIPADDR3 1
95
96/* UIP_ETHADDR: The Ethernet address. */
97#define UIP_ETHADDR0 0x00
98#define UIP_ETHADDR1 0x00
99#define UIP_ETHADDR2 0x00
100#define UIP_ETHADDR3 0x64
101#define UIP_ETHADDR4 0x64
102#define UIP_ETHADDR5 0x64
103
104
105/*-----------------------------------------------------------------------------------*/
106/* The following options are used to configure application specific
107 * setting such as how many TCP ports that should be avaliable and if
108 * the uIP should be configured to support active opens.
109 *
110 * These should probably be tweaked to suite your project.
111 */
112
113/* Include the header file for the application program that should be
114 used. If you don't use the example web server, you should change
115 this. */
116#include "dispatcher.h"
117
118/* UIP_ACTIVE_OPEN: Determines if support for opening connections from
119 uIP should be compiled in. If this isn't needed for your
120 application, don't turn it on. (A web server doesn't need this, for
121 instance.) */
122#define UIP_ACTIVE_OPEN 1
123
124/* UIP_CONNS: The maximum number of simultaneously active
125 connections. */
126#define UIP_CONNS 6
127
128/* UIP_LISTENPORTS: The maximum number of simultaneously listening TCP
129 ports. For a web server, 1 is enough here. */
130#define UIP_LISTENPORTS 6
131
132/* UIP_BUFSIZE: The size of the buffer that holds incoming and
133 outgoing packets. */
134#ifdef WITH_ETHERNET
135#define UIP_BUFSIZE 360
136#else /* WITH_ETHERNET */
137#define UIP_BUFSIZE 300
138#endif /* WITH_ETHERNET */
139
140/* UIP_STATISTICS: Determines if statistics support should be compiled
141 in. The statistics is useful for debugging and to show the user. */
142#define UIP_STATISTICS 0
143
144/* UIP_LOGGING: Determines if logging of certain events should be
145 compiled in. Useful mostly for debugging. The function uip_log(char
146 *msg) must be implemented to suit your architecture if logging is
147 turned on. */
148#define UIP_LOGGING 0
149
150/* UIP_LLH_LEN: The link level header length; this is the offset into
151 the uip_buf where the IP header can be found. For Ethernet, this
152 should be set to 14. For SLIP, this should be set to 0. */
153#ifdef WITH_ETHERNET
154#define UIP_LLH_LEN 14
155#else /* WITH_ETHERNET */
156#define UIP_LLH_LEN 0
157#endif /* WITH_ETHERNET */
158
159/*-----------------------------------------------------------------------------------*/
160/* The following configuration options can be tweaked for your
161 * project, but you are probably safe to use the default values. The
162 * options are listed in order of tweakability.
163 */
164
165/* UIP_ARPTAB_SIZE: The size of the ARP table - use a larger value if
166 this uIP node will have many connections from the local network. */
167#define UIP_ARPTAB_SIZE 8
168
169/* The maxium age of ARP table entries measured in 10ths of
170 seconds. An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
171 default). */
172#define UIP_ARP_MAXAGE 120
173
174/* UIP_RTO: The retransmission timeout counted in timer pulses (i.e.,
175 the speed of the periodic timer, usually one second). */
176#define UIP_RTO 3
177
178/* UIP_MAXRTX: The maximum number of times a segment should be
179 retransmitted before the connection should be aborted. */
180#define UIP_MAXSYNRTX 8
181#define UIP_MAXRTX 8
182
183/* UIP_TCP_MSS: The TCP maximum segment size. This should be set to
oliverschmidt648593b2005-02-23 22:43:53 +0000184 at most UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. */
185#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN - 2)
adamdunkels2f5291c2003-04-09 12:55:06 +0000186
187/* UIP_TTL: The IP TTL (time to live) of IP packets sent by uIP. */
188#define UIP_TTL 255
189
190/* UIP_TIME_WAIT_TIMEOUT: How long a connection should stay in the
191 TIME_WAIT state. Has no real implication, so it should be left
192 untouched. */
193#define UIP_TIME_WAIT_TIMEOUT 120
194/*-----------------------------------------------------------------------------------*/
195/* This is where you configure if your CPU architecture is big or
196 * little endian. Most CPUs today are little endian. The most notable
197 * exception are the Motorolas which are big endian. Tweak the
198 * definition of the BYTE_ORDER macro to configure uIP for your
199 * project.
200 */
201#ifndef LITTLE_ENDIAN
202#define LITTLE_ENDIAN 3412
203#endif /* LITTLE_ENDIAN */
204#ifndef BIG_ENDIAN
205#define BIG_ENDIAN 1234
206#endif /* BIGE_ENDIAN */
207
208#ifndef BYTE_ORDER
209#define BYTE_ORDER LITTLE_ENDIAN
210#endif /* BYTE_ORDER */
211
212#endif /* __UIPOPT_H__ */