Configuration options for uIP

Files

file  uipopt.h
file  uip-conf.h

Defines

#define UIP_LITTLE_ENDIAN   3412
#define UIP_BIG_ENDIAN   1234

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.



typedef uint8_t u8_t
typedef uint16_t u16_t
typedef unsigned short uip_stats_t
#define UIP_CONF_MAX_CONNECTIONS   40
#define UIP_CONF_MAX_LISTENPORTS   40
#define UIP_CONF_BUFFER_SIZE   420
#define UIP_CONF_BYTE_ORDER   LITTLE_ENDIAN
#define UIP_CONF_LOGGING   1
#define UIP_CONF_UDP   0
#define UIP_CONF_UDP_CHECKSUMS   1
#define UIP_CONF_STATISTICS   1

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


typedef struct hello_world_state uip_tcp_appstate_t
typedef struct dhcpc_state uip_udp_appstate_t
#define UIP_APPCALL   hello_world_appcall

General configuration options



void uip_log (char *msg)
#define UIP_BUFSIZE
#define UIP_STATISTICS
#define UIP_LOGGING
#define UIP_BROADCAST
#define UIP_LLH_LEN

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
#define UIP_PINGADDRCONF
#define UIP_FIXEDETHADDR

IP configuration options



#define UIP_TTL   64
#define UIP_REASSEMBLY
#define UIP_REASS_MAXAGE   40

UDP configuration options



#define UIP_UDP
#define UIP_UDP_CHECKSUMS
#define UIP_UDP_CONNS

TCP configuration options

The name of the function that should be called when UDP datagrams arrive.



#define UIP_ACTIVE_OPEN
#define UIP_CONNS
#define UIP_LISTENPORTS
#define UIP_URGDATA
#define UIP_RTO   3
#define UIP_MAXRTX   8
#define UIP_MAXSYNRTX   5
#define UIP_TCP_MSS   (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
#define UIP_RECEIVE_WINDOW
#define UIP_TIME_WAIT_TIMEOUT   120

ARP configuration options



#define UIP_ARPTAB_SIZE
#define UIP_ARP_MAXAGE   120

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

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.

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.

define UIP_APPCALL   hello_world_appcall

The name of the application function that uIP should call in response to TCP/IP events.

#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).

#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.

#define UIP_BIG_ENDIAN   1234
#define UIP_BROADCAST

Broadcast support.

This flag configures IP broadcast support. This is useful only together with UDP.

#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.

#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).

#define UIP_CONF_BUFFER_SIZE   420

uIP buffer size.

#define UIP_CONF_BYTE_ORDER   LITTLE_ENDIAN

CPU byte order.

#define UIP_CONF_LOGGING   1

Logging on or off

#define UIP_CONF_MAX_CONNECTIONS   40

Maximum number of TCP connections.

#define UIP_CONF_MAX_LISTENPORTS   40

Maximum number of listening TCP ports.

#define UIP_CONF_STATISTICS   1

uIP statistics on or off

#define UIP_CONF_UDP   0

UDP support on or off

#define UIP_CONF_UDP_CHECKSUMS   1

UDP checksums on or off

#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.

#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.

#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.

#define UIP_LISTENPORTS

The maximum number of simultaneously listening TCP ports.

Each listening TCP port requires 2 bytes of memory.

#define UIP_LITTLE_ENDIAN   3412
#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.

#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.

#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.

#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.

#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.
#define UIP_REASS_MAXAGE   40

The maximum time an IP fragment should wait in the reassembly buffer before it is dropped.

#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.
#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.

#define UIP_RTO   3

The initial retransmission timeout counted in timer pulses.

This should not be changed.

#define UIP_STATISTICS

Determines if statistics support should be compiled in.

The statistics is useful for debugging and to show the user.

#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.

#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.

#define UIP_TTL   64

The IP TTL (time to live) of IP packets sent by uIP.

This should normally not be changed.

#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.

Note:
Support for UDP checksums is currently not included in uIP, so this option has no function.
#define UIP_UDP_CONNS

The maximum amount of concurrent UDP connections.

#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.


Typedef Documentation

typedef uint16_t u16_t

16 bit datatype

This typedef defines the 16-bit type used throughout uIP.

typedef uint8_t u8_t

8 bit datatype

This typedef defines the 8-bit type used throughout uIP.

typedef unsigned short uip_stats_t

Statistics datatype

This typedef defines the dataype used for keeping statistics in uIP.

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.

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.


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.

Here is the call graph for this function:


Generated on 22 Jan 2016 for MIDIboxNG by  doxygen 1.6.1