Files | Defines

Configuration options for uIP

Files

file  uip-conf.h
file  uipopt.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 uint32_t u32_t
typedef unsigned short uip_stats_t
#define ALIGN_STRUCT_END   __attribute__((aligned(4)))
#define UIP_CONF_MAX_CONNECTIONS
#define UIP_CONF_MAX_LISTENPORTS
#define UIP_CONF_BUFFER_SIZE
#define UIP_CONF_BYTE_ORDER
#define UIP_CONF_LOGGING
#define UIP_CONF_UDP
#define UIP_CONF_UDP_CHECKSUMS
#define UIP_CONF_STATISTICS

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   services_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 ALIGN_STRUCT_END   __attribute__((aligned(4)))

Representation of a 48-bit Ethernet address.

Definition at line 61 of file uip-conf.h.

#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_APPCALL   services_appcall

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

Definition at line 29 of file mult_uip.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.

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

#define UIP_BIG_ENDIAN   1234

Definition at line 67 of file uipopt.h.

#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 381 of file uipopt.h.

#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 473 of file uipopt.h.

#define UIP_CONF_BUFFER_SIZE

uIP buffer size.

Definition at line 119 of file uip-conf.h.

#define UIP_CONF_BYTE_ORDER

CPU byte order.

Definition at line 126 of file uip-conf.h.

#define UIP_CONF_LOGGING

Logging on or off

Definition at line 133 of file uip-conf.h.

#define UIP_CONF_MAX_CONNECTIONS

Maximum number of TCP connections.

Definition at line 105 of file uip-conf.h.

#define UIP_CONF_MAX_LISTENPORTS

Maximum number of listening TCP ports.

Definition at line 112 of file uip-conf.h.

#define UIP_CONF_STATISTICS

uIP statistics on or off

Definition at line 154 of file uip-conf.h.

#define UIP_CONF_UDP

UDP support on or off

Definition at line 140 of file uip-conf.h.

#define UIP_CONF_UDP_CHECKSUMS

UDP checksums on or off

Definition at line 147 of file uip-conf.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.

Definition at line 247 of file uipopt.h.

#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 261 of file uipopt.h.

#define UIP_LITTLE_ENDIAN   3412

Definition at line 64 of file uipopt.h.

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

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

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

#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_REASS_MAXAGE   40

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

Definition at line 163 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.

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

#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

Toggles wether UDP support should be compiled in or not.

Definition at line 179 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 193 of file uipopt.h.

#define UIP_UDP_CONNS

The maximum amount of concurrent UDP connections.

Definition at line 206 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.

Definition at line 79 of file uip-conf.h.

typedef uint32_t u32_t

32 bit datatype

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

Definition at line 88 of file uip-conf.h.

typedef uint8_t u8_t

8 bit datatype

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

Definition at line 70 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 98 of file uip-conf.h.

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.

Definition at line 33 of file mult_uip.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.