RF24Ethernet - TCP/IP over RF24Network v1.6.14
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
uip-conf.h
Go to the documentation of this file.
1/** @file uip-conf.h*/
2/**
3 * \name User configuration options
4 * @{
5 *
6 * uIP has a number of configuration options that can be overridden
7 * for each project. These are kept in a project-specific uip-conf.h
8 * file and all configuration names have the prefix UIP_CONF.
9 * Some of these options are specific to RF24Ethernet.
10 */
11
12/*
13 * Copyright (c) 2006, Swedish Institute of Computer Science.
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the Institute nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * This file is part of the uIP TCP/IP stack
41 * Modified 2015: TMRh20
42 */
43
44#ifndef __UIP_CONF_H__
45#define __UIP_CONF_H__
46
47#include <inttypes.h>
48
49#include "RF24Network_config.h"
50/************* TMRh20: User Configuration *******************/
51/**
52 * @defgroup UipConfiguration uIP Configuration
53 *
54 * User Configuration Options
55 * @{
56 */
57
58/** @brief Maximum number of TCP connections. */
59#define UIP_CONF_MAX_CONNECTIONS 1
60
61/** @brief Maximum number of listening TCP ports. */
62#define UIP_CONF_MAX_LISTENPORTS 1
63
64/**
65 * @brief uIP buffer size.
66 * @note For simplicity, this is automatically set to the MAX_PAYLOAD_SIZE configured in the RF24Network_conf.h file, but can be configured independently
67 * of RF24Network if desired.
68 *
69 * @remarks
70 * 1. Nodes can use different buffer sizes, direct TCP communication is limited to the smallest
71 * ie: A RPi can be configured to use 1500byte TCP windows, with Arduino nodes using only 120byte TCP windows.
72 * 2. Routing nodes handle traffic at the link-layer, so the MAX_PAYLOAD_SIZE is not important, unless they are
73 * running RF24Ethernet.
74 * 3. Nodes running RF24Ethernet generally do not need to support RF24Network user payloads. Edit RF24Network_config.h
75 * and uncomment `#define DISABLE_USER_PAYLOADS`. This will free memory not used with RF24Ethernet.
76 * 4. The user buffers are automatically configured to (Buffer Size - Link Layer Header Size - TCP Header Size) so
77 * using RF24Mesh will decrease payloads by 14 bytes.
78 * 5. Larger buffer sizes increase throughput for individual nodes, but can impact other network traffic.
79 * 6. Max usable value is 512
80 */
81
82#define UIP_CONF_BUFFER_SIZE MAX_PAYLOAD_SIZE - 2
83/**
84 * @brief <b>Optional:</b> Uncomment to disable
85 *
86 * Adjust the length of time after which an open connection will be timed out.
87 *
88 * If uIP is polling the established connection, but an ack or data is not received for this duration in ms, kill the connection.
89 */
90#define UIP_CONNECTION_TIMEOUT 45000
91
92/**
93 * @brief SLIP/TUN - 14 for Ethernet/TAP & 0 for TUN/SLIP
94 *
95 * Ethernet headers add an additional 14 bytes to each payload.
96 *
97 * RF24Mesh generally needs to be used if setting this to 0 and using a TUN or SLIP interface
98 */
99#define UIP_CONF_LLH_LEN 0
100
101/**
102 * @brief UDP support on or off (required for DNS)
103 * @note DNS support typically requires larger payload sizes (250-300). It seems that DNS servers will typically respond
104 * with a single address if requesting an address of www.google.com vs google.com, and this will work with the default payload size
105 */
106
107#define UIP_CONF_UDP 0
108//#define UIP_CONF_BROADCAST 0
109//#define UIP_CONF_UDP_CONNS 1
110
111/**
112 * @}
113 * @name Advanced Operation
114 *
115 * For advanced configuration of RF24Ethernet
116 * @{
117 */
118
119/**
120 * @brief Adjust the rate at which the IP stack performs periodic processing.
121 *
122 * The periodic timer will be called at a rate of 1 second divided by this value
123 *
124 * Increase this value to reduce response times and increase throughput during user interactions.
125 * @note: Increasing this value will increase throughput for individual nodes, but can impact other network traffic.
126 */
127#define UIP_TIMER_DIVISOR 16
128
129/**
130 * If operating solely as a server, disable the ability to open TCP connections as a client by setting to 0
131 * Saves memory and program space.
132 */
133#define UIP_CONF_ACTIVE_OPEN 1
134
135/** @brief UDP checksums on or off */
136#define UIP_CONF_UDP_CHECKSUMS 0
137
138/**
139 * @brief uIP User Output buffer size
140 *
141 * The output buffer size determines the max
142 * length of strings that can be sent by the user, and depends on the uip buffer size
143 *
144 * Must be <= UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN
145 * @note Must be an odd number or the TCP/IP sequence gets out of order with payloads larger than 511 bytes
146 * I think this might be a bug or missing feature of the uip stack
147 */
148#define UIP_CONF_EXTERNAL_BUFFER
149
150#if UIP_CONF_BUFFER_SIZE >= 512
151 #define OUTPUT_BUFFER_SIZE 511
152#else
153 #define OUTPUT_BUFFER_SIZE UIP_CONF_BUFFER_SIZE - UIP_CONF_LLH_LEN - UIP_TCPIP_HLEN
154#endif
155
156/**
157 * @brief <b>Optional:</b> Used with UIP_CONNECTION_TIMEOUT
158 *
159 * If an open connection is not receiving data, the connection will be restarted.
160 *
161 * Adjust the initial delay period before restarting a connection that has already been restarted
162 *
163 * For small payloads (96-120 bytes) with a fast connection, this value can be as low as ~750ms or so.
164 * When increasing the uip buffer size, this value should be increased, or
165 * the window may be reopened while the requested data is still being received, hindering traffic flow.
166 */
167#define UIP_WINDOW_REOPEN_DELAY 3550
168
169/** @} */
170/** @} */
171/******************** END USER CONFIG ***********************************/
172
173/********** TMRh20: This option is not yet valid **********/
174/* @brief for TCP */
175#define UIP_SOCKET_NUMPACKETS 1
176
177/**
178 * @brief The TCP receive window.
179 *
180 * This is should not be to set to more than
181 * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
182 * @note Must be an odd number or the TCP/IP sequence gets out of order with payloads larger than 511 bytes
183 * I think this might be a bug or missing feature of the uip stack
184 */
185#if UIP_CONF_BUFFER_SIZE >= 512
186 #define UIP_CONF_RECEIVE_WINDOW 511
187#else
188 //#define UIP_CONF_RECEIVE_WINDOW UIP_CONF_BUFFER_SIZE *2 - UIP_CONF_LLH_LEN - UIP_TCPIP_HLEN //This is set automatically to the max allowable size
189 #define UIP_CONF_RECEIVE_WINDOW UIP_CONF_BUFFER_SIZE - UIP_CONF_LLH_LEN - UIP_TCPIP_HLEN // This is set automatically to the max allowable size
190#endif
191
192#define UIP_CONF_TCP_MSS OUTPUT_BUFFER_SIZE
193
194/**
195 * @brief CPU byte order.
196 *
197 * \hideinitializer
198 */
199#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
200
201/**
202 * @brief Logging on or off
203 *
204 * \hideinitializer
205 */
206//#define UIP_CONF_LOGGING 1
207#define UIP_CONF_LOGGING 0
208
209/**
210 * @brief uIP statistics on or off
211 *
212 * \hideinitializer
213 */
214#define UIP_CONF_STATISTICS 0
215
216// Define config for TAP or TUN based on Link-layer header length
217#if UIP_CONF_LLH_LEN > 0
218 #define RF24_TAP
219#endif
220
221#if defined UIP_TIMER_DIVISOR
222 #if UIP_TIMER_DIVISOR > 5
223 #define UIP_CONF_RTO (UIP_TIMER_DIVISOR / 2)
224 #else
225 #define UIP_CONF_RTO 3
226 #endif
227#endif
228
229/**
230 * @brief 8 bit datatype
231 *
232 * This typedef defines the 8-bit type used throughout uIP.
233 *
234 * \hideinitializer
235 */
236typedef uint8_t u8_t;
237
238/**
239 * @brief 16 bit datatype
240 *
241 * This typedef defines the 16-bit type used throughout uIP.
242 *
243 * \hideinitializer
244 */
245typedef uint16_t u16_t;
246
247/**
248 * @brief Statistics datatype
249 *
250 * This typedef defines the dataype used for keeping statistics in
251 * uIP.
252 *
253 * \hideinitializer
254 */
255typedef unsigned short uip_stats_t;
256
257/** \hideinitializer */
258typedef void* uip_tcp_appstate_t;
259
260/** \hideinitializer */
261void serialip_appcall(void);
262/** \hideinitializer */
263#define UIP_APPCALL serialip_appcall
264
265/** \hideinitializer */
266typedef void* uip_udp_appstate_t;
267
268/** \hideinitializer */
269void uipudp_appcall(void);
270
271/** \hideinitializer */
272#define UIP_UDP_APPCALL uipudp_appcall
273
274#if UIP_CONF_LOGGING > 0
275void uip_log(char* msg);
276#endif
277
278#endif /* __UIP_CONF_H__ */
void uip_log(char *msg)
Definition: RF24Client.cpp:228
void * uip_tcp_appstate_t
Definition: uip-conf.h:258
uint8_t u8_t
8 bit datatype
Definition: uip-conf.h:236
unsigned short uip_stats_t
Statistics datatype.
Definition: uip-conf.h:255
uint16_t u16_t
16 bit datatype
Definition: uip-conf.h:245
void * uip_udp_appstate_t
Definition: uip-conf.h:266
void serialip_appcall(void)
Definition: RF24Client.cpp:240
void uipudp_appcall(void)