- Main Page
- Modules
- Data Structures
- Files
- Examples

# Configuration options for uIP

## Detailed Description

uIP is configured using the per-project configuration file uipopt.h.

This file contains all compile-time options for uIP and should be tweaked to match each specific project. The uIP distribution contains a documented example "uipopt.h" that can be copied and modified for each project.

Note:
  Most of the configuration options in the uipopt.h should not be changed, but rather the per-project uip-conf.h file.

## Files
file | uip-conf.h
| An example uIP configuration file.

file | uipopt.h
| Configuration options for uIP.

## Project-specific configuration options
uIP has a number of configuration options that can be overridden for each project. These are kept in a project-specific uip-conf.h file and all configuration names have the prefix UIP_CONF.
#define | UIP_CONF_MAX_CONNECTIONS
| Maximum number of TCP connections.
#define | UIP_CONF_MAX_LISTENPORTS
| Maximum number of listening TCP ports.
#define | UIP_CONF_BUFFER_SIZE
| uIP buffer size.
#define | UIP_CONF_BYTE_ORDER
| CPU byte order.
#define | UIP_CONF_LOGGING
| Logging on or off.
#define | UIP_CONF_UDP
| UDP support on or off.
#define | UIP_CONF_UDP_CHECKSUMS
| UDP checksums on or off.
#define | UIP_CONF_STATISTICS
| uIP statistics on or off
typedef uint8_t | u8_t
| 8 bit datatype
typedef uint16_t | u16_t
| 16 bit datatype
typedef unsigned short | uip_stats_t
| Statistics datatype.
## Static configuration options
These configuration options can be used for setting the IP address settings statically, but only if UIP_FIXEDADDR is set to 1. The configuration options for a specific node includes IP address, netmask and default router as well as the Ethernet address. The netmask, default router and Ethernet address are appliciable only if uIP should be run over Ethernet. All of these should be changed to suit your project.
#define | UIP_FIXEDADDR
| Determines if uIP should use a fixed IP address or not.
#define | UIP_PINGADDRCONF
| Ping IP address asignment.
#define | UIP_FIXEDETHADDR
| Specifies if the uIP ARP module should be compiled with a fixed Ethernet MAC address or not.
## IP configuration options
#define | UIP_TTL 64
| The IP TTL (time to live) of IP packets sent by uIP.
#define | UIP_REASSEMBLY
| Turn on support for IP packet reassembly.
#define | UIP_REASS_MAXAGE 40
| The maximum time an IP fragment should wait in the reassembly buffer before it is dropped.
## UDP configuration options
#define | UIP_UDP
| Toggles wether UDP support should be compiled in or not.
#define | UIP_UDP_CHECKSUMS
| Toggles if UDP checksums should be used or not.
#define | UIP_UDP_CONNS
| The maximum amount of concurrent UDP connections.
## TCP configuration options
#define | UIP_ACTIVE_OPEN
| Determines if support for opening connections from uIP should be compiled in.
#define | UIP_CONNS
| The maximum number of simultaneously open TCP connections.
#define | UIP_LISTENPORTS
| The maximum number of simultaneously listening TCP ports.
#define | UIP_URGDATA
| Determines if support for TCP urgent data notification should be compiled in.
#define | UIP_RTO 3
| The initial retransmission timeout counted in timer pulses.
#define | UIP_MAXRTX 8
| The maximum number of times a segment should be retransmitted before the connection should be aborted.
#define | UIP_MAXSYNRTX 5
| The maximum number of times a SYN segment should be retransmitted before a connection request should be deemed to have been unsuccessful.
#define | UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
| The TCP maximum segment size.
#define | UIP_RECEIVE_WINDOW
| The size of the advertised receiver's window.
#define | UIP_TIME_WAIT_TIMEOUT 120
| How long a connection should stay in the TIME_WAIT state.
## ARP configuration options
#define | UIP_ARPTAB_SIZE
| The size of the ARP table.
#define | UIP_ARP_MAXAGE 120
| The maxium age of ARP table entries measured in 10ths of seconds.
## General configuration options
#define | UIP_BUFSIZE
| The size of the uIP packet buffer.
#define | UIP_STATISTICS
| Determines if statistics support should be compiled in.
#define | UIP_LOGGING
| Determines if logging of certain events should be compiled in.
#define | UIP_BROADCAST
| Broadcast support.
#define | UIP_LLH_LEN
| The link level header length.
void | uip_log (char *msg)
| Print out a uIP log message.
## CPU architecture configuration
The CPU architecture configuration is where the endianess of the CPU on which uIP is to be run is specified. Most CPUs today are little endian, and the most notable exception are the Motorolas which are big endian. The BYTE_ORDER macro should be changed to reflect the CPU architecture on which uIP is to be run.
#define | UIP_BYTE_ORDER
| The byte order of the CPU architecture on which uIP is to be run.
## Appication specific configurations
An uIP application is implemented using a single application function that is called by uIP whenever a TCP/IP event occurs. The name of this function must be registered with uIP at compile time using the UIP_APPCALL definition. uIP applications can store the application state within the uip_conn structure by specifying the type of the application structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. The file containing the definitions must be included in the uipopt.h file. The following example illustrates how this can look.
    void httpd_appcall(void);
    #define UIP_APPCALL     httpd_appcall

    struct httpd_state {
      u8_t state;
      u16_t count;
      char *dataptr;
      char *script;
    };
    typedef struct httpd_state uip_tcp_appstate_t
#define | UIP_APPCALL smtp_appcall
| The name of the application function that uIP should call in response to TCP/IP events.
typedef smtp_state | uip_tcp_appstate_t
| The type of the application state that is to be stored in the uip_conn structure.
typedef int | uip_udp_appstate_t
| The type of the application state that is to be stored in the uip_conn structure.
## Defines
#define | UIP_LITTLE_ENDIAN 3412
#define | UIP_BIG_ENDIAN 1234

## Define Documentation

#define UIP_ACTIVE_OPEN

| Determines if support for opening connections from uIP should be compiled in. If the applications that are running on top of uIP for this project do not need to open outgoing TCP connections, this configration option can be turned off to reduce the code size of uIP. Definition at line 233 of file uipopt.h.

#define UIP_ARP_MAXAGE 120

| The maxium age of ARP table entries measured in 10ths of seconds. An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD default). Definition at line 358 of file uipopt.h. Referenced by uip_arp_timer().

#define UIP_ARPTAB_SIZE

| The size of the ARP table. This option should be set to a larger value if this uIP node will have many connections from the local network. Definition at line 349 of file uipopt.h. Referenced by uip_arp_init(), uip_arp_out(), and uip_arp_timer().

#define UIP_BROADCAST

| Broadcast support. This flag configures IP broadcast support. This is useful only together with UDP. Definition at line 423 of file uipopt.h.

#define UIP_BUFSIZE

| The size of the uIP packet buffer. The uIP packet buffer should not be smaller than 60 bytes, and does not need to be larger than 1500 bytes. Lower size results in lower TCP throughput, larger size results in higher TCP throughput. Definition at line 379 of file uipopt.h. Referenced by uip_split_output().

#define UIP_BYTE_ORDER

| The byte order of the CPU architecture on which uIP is to be run. This option can be either BIG_ENDIAN (Motorola byte order) or LITTLE_ENDIAN (Intel byte order). Definition at line 475 of file uipopt.h.

#define UIP_CONNS

| The maximum number of simultaneously open TCP connections. Since the TCP connections are statically allocated, turning this configuration knob down results in less RAM used. Each TCP connection requires approximatly 30 bytes of memory. Examples: example-mainloop-with-arp.c, and example-mainloop-without-arp.c. Definition at line 245 of file uipopt.h. Referenced by uip_connect().

#define UIP_FIXEDADDR

| Determines if uIP should use a fixed IP address or not. If uIP should use a fixed IP address, the settings are set in the uipopt.h file. If not, the macros uip_sethostaddr(), uip_setdraddr() and uip_setnetmask() should be used instead. Definition at line 97 of file uipopt.h.

#define UIP_FIXEDETHADDR

| Specifies if the uIP ARP module should be compiled with a fixed Ethernet MAC address or not. If this configuration option is 0, the macro uip_setethaddr() can be used to specify the Ethernet address at run-time. Definition at line 127 of file uipopt.h.

#define UIP_LISTENPORTS

| The maximum number of simultaneously listening TCP ports. Each listening TCP port requires 2 bytes of memory. Definition at line 259 of file uipopt.h. Referenced by uip_init(), uip_listen(), and uip_unlisten().

#define UIP_LLH_LEN

| The link level header length. This is the offset into the uip_buf where the IP header can be found. For Ethernet, this should be set to 14. For SLIP, this should be set to 0. Definition at line 448 of file uipopt.h. Referenced by uip_ipchksum(), uip_process(), and uip_split_output().

#define UIP_LOGGING

| Determines if logging of certain events should be compiled in. This is useful mostly for debugging. The function uip_log() must be implemented to suit the architecture of the project, if logging is turned on. Definition at line 408 of file uipopt.h.

#define UIP_MAXRTX 8

| The maximum number of times a segment should be retransmitted before the connection should be aborted. This should not be changed. Definition at line 288 of file uipopt.h. Referenced by uip_process().

#define UIP_MAXSYNRTX 5

| The maximum number of times a SYN segment should be retransmitted before a connection request should be deemed to have been unsuccessful. This should not need to be changed. Definition at line 297 of file uipopt.h. Referenced by uip_process().

#define UIP_PINGADDRCONF

| Ping IP address asignment. uIP uses a "ping" packets for setting its own IP address if this option is set. If so, uIP will start with an empty IP address and the destination IP address of the first incoming "ping" (ICMP echo) packet will be used for setting the hosts IP address. Note: This works only if UIP_FIXEDADDR is 0. Definition at line 114 of file uipopt.h.

#define UIP_REASSEMBLY

| Turn on support for IP packet reassembly. uIP supports reassembly of fragmented IP packets. This features requires an additonal amount of RAM to hold the reassembly buffer and the reassembly code size is approximately 700 bytes. The reassembly buffer is of the same size as the uip_buf buffer (configured by UIP_BUFSIZE). Note: IP packet reassembly is not heavily tested. Definition at line 156 of file uipopt.h.

#define UIP_RECEIVE_WINDOW

| The size of the advertised receiver's window. Should be set low (i.e., to the size of the uip_buf buffer) is the application is slow to process incoming data, or high (32768 bytes) if the application processes data quickly. Definition at line 317 of file uipopt.h.

#define UIP_RTO 3

| The initial retransmission timeout counted in timer pulses. This should not be changed. Definition at line 280 of file uipopt.h. Referenced by uip_process().

#define UIP_STATISTICS

| Determines if statistics support should be compiled in. The statistics is useful for debugging and to show the user. Definition at line 393 of file uipopt.h.

#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)

| The TCP maximum segment size. This is should not be to set to more than UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. Definition at line 305 of file uipopt.h.

#define UIP_TIME_WAIT_TIMEOUT 120

| How long a connection should stay in the TIME_WAIT state. This configiration option has no real implication, and it should be left untouched. Definition at line 328 of file uipopt.h. Referenced by uip_process().

#define UIP_TTL 64

| The IP TTL (time to live) of IP packets sent by uIP. This should normally not be changed. Definition at line 141 of file uipopt.h.

#define UIP_UDP_CHECKSUMS

| Toggles if UDP checksums should be used or not. Note: Support for UDP checksums is currently not included in uIP, so this option has no function. Definition at line 195 of file uipopt.h.

#define UIP_URGDATA

| Determines if support for TCP urgent data notification should be compiled in. Urgent data (out-of-band data) is a rarely used TCP feature that very seldom would be required. Definition at line 273 of file uipopt.h.

## Typedef Documentation

typedef uint16_t u16_t

| 16 bit datatype This typedef defines the 16-bit type used throughout uIP. Examples: dhcpc.c, dhcpc.h, resolv.c, resolv.h, smtp.c, smtp.h, telnetd.c, and uip-conf.h. Definition at line 76 of file uip-conf.h.

typedef uint8_t u8_t

| 8 bit datatype This typedef defines the 8-bit type used throughout uIP. Examples: dhcpc.c, dhcpc.h, resolv.c, smtp.h, telnetd.c, telnetd.h, and uip-conf.h. Definition at line 67 of file uip-conf.h.

typedef unsigned short uip_stats_t

| Statistics datatype. This typedef defines the dataype used for keeping statistics in uIP. Definition at line 86 of file uip-conf.h.

typedef uip_tcp_appstate_t

| The type of the application state that is to be stored in the uip_conn structure. This usually is typedef:ed to a struct holding application state information. Examples: smtp.h, telnetd.h, and webclient.h. Definition at line 98 of file smtp.h.

typedef uip_udp_appstate_t

| The type of the application state that is to be stored in the uip_conn structure. This usually is typedef:ed to a struct holding application state information. Examples: dhcpc.h. Definition at line 47 of file resolv.h.

## Function Documentation

void uip_log | ( | char * | msg | ) |

| Print out a uIP log message. This function must be implemented by the module that uses uIP, and is called by uIP whenever a log message is generated.