weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Modules | Data Structures | Defines | Typedefs | Functions | Variables
+ + uIP -- Adam Dunkels' TCP/IP stack + +
+ + + weAutSys -- software incorporated from other sources + + +

Overview

uIP is a platform independent TCP/IP stack implementation intended for small 8-bit and 16-bit micro-controllers. It provides the necessary protocols for Internet communication, with a very small code footprint and RAM requirements. It supports just one network interface controller (NIC) which fits weAut_01 and akin modules.

weAutSys adapts uIP to ATmega, AVR-C and to the ENC28J60 interface chip by appropriate driver and support functions. Besides the (macro) settings in the file uipopts.h some adjustments in the uIP code were indicated.

As of this writing the base for the weAutSys port is uIP V.1.0. With said adjustments and corrections it is, of course, re-published as open source.


Modules

 Architecture specific uIP functions and types
 uIP conversion functions
 uIP configuration functions
 uIP initialisation functions
 uIP device driver functions
 Variables for uIP device drivers
 uIP application functions
 Configuration options for uIP

Data Structures

struct  uip_eth_addr
 Representation of a 48-bit Ethernet address / MAC address. More...
struct  uip_icmpip_hdr
 The ICMP and IP headers. More...
struct  uip_tcpip_hdr
 The TCP and IP headers. More...
struct  uip_udpip_hdr
 The UDP and IP headers. More...

Defines

#define UIP_APPDATA_SIZE
 The buffer size available for user data in the buffer uip_buf.
#define UIP_CLOSED
 state value in uip_conn->tcpstateflags
#define UIP_CLOSING
 state value in uip_conn->tcpstateflags
#define UIP_DATA
 flag to uip_process(): incoming data in uip_buf
#define UIP_ESTABLISHED
 state value in uip_conn->tcpstateflags
#define UIP_FIN_WAIT_1
 state value in uip_conn->tcpstateflags
#define UIP_FIN_WAIT_2
 state value in uip_conn->tcpstateflags
#define UIP_LAST_ACK
 state value in uip_conn->tcpstateflags
#define UIP_POLL_REQUEST
 flag to uip_process(): poll a connection
#define UIP_STOPPED
 extra state bit in uip_conn->tcpstateflags
#define UIP_SYN_RCVD
 state value in uip_conn->tcpstateflags
#define UIP_SYN_SENT
 state value in uip_conn->tcpstateflags
#define UIP_TIME_WAIT
 state value in uip_conn->tcpstateflags
#define UIP_TIMER
 flag to uip_process(): periodic timer has fired
#define UIP_TS_MASK
 mask for state values in uip_conn->tcpstateflags
#define UIP_UDP_SEND_CONN
 flag to uip_process(): construct UDP datagram in uip_buf

Typedefs

typedef uint16_t uip_ip4addr_t [2]
 Representation of an IP V4 address.
typedef uint16_t uip_ip6addr_t [8]
 Representation of an IP (V6) address.
typedef uip_ip4addr_t uip_ipaddr_t
 IP address is of type IP V4.

Functions

uint16_t uip_chksum (uint16_t *buf, uint16_t len)
 Calculate the Internet checksum over a buffer.
uint16_t uip_ipchksum (void)
 Calculate the IP header checksum of the packet header in uip_buf.
void uip_process (uint8_t flag)
 The actual uIP function which does all the work.
uint16_t uip_tcpchksum (void)
 Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
uint16_t uip_udpchksum (void)
 Calculate the UDP checksum of the packet in uip_buf and uip_appdata.
void uipSecTick (void)
 One second tick for the uiP stack.

Variables

struct uip_eth_addr actMACadd
 The (actual) MAC address.
void * uip_appdata
 Pointer to the application data in the packet buffer.

Define Documentation

The buffer size available for user data in the buffer uip_buf.

This macro holds the available size for user data in uip_buf . It is intended to be used for checking bounds of available user data.


Typedef Documentation

typedef uint16_t uip_ip4addr_t[2]

Representation of an IP V4 address.

For IP V4 (used as of this writing in small modules like weAut_01) this is uIP's type uip_ipaddr_t being just an array uint16_t [2] in the end.

Note:
An Internet address of e.g. 1.2.3.4 would reside in this array in the (wrong i.e. network i.e. big) endianess: { 0x0201 , 0x0403 } . Representation of an IP (V4) address

Function Documentation

void uip_process ( uint8_t  flag)

The actual uIP function which does all the work.

Parameters:
flagsays on what reason this function is called
uint16_t uip_chksum ( uint16_t *  buf,
uint16_t  len 
)

Calculate the Internet checksum over a buffer.

The Internet checksum is the one's complement of the one's complement sum of all 16-bit words in the buffer.

See RFC1071.
See also the ENC28J60's data sheet. This Ethernet driver chip can calculate just this type of checksum as an extra service described under the the (miss-leading) header of "DMA functions". As a pity, uIP's internal proceedings calculate this checksum before the data will be put to the Ethernet chip respectively after the are copied out by the driver interface functions. So it would be a hard job with deep impact on uIP to have the chip calculate the IP checksum too en lieu of this function uip_chksum which is quite expensive on micro-controllers.

Parameters:
bufA pointer to the buffer over which the checksum is to be computed.
lenThe length of the buffer over which the checksum is to be computed.
Returns:
The Internet checksum of the buffer.
uint16_t uip_ipchksum ( void  )

Calculate the IP header checksum of the packet header in uip_buf.

The IP header checksum is the Internet checksum of the 20 bytes of the IP header.

Returns:
The IP header checksum of the IP header in the uip_buf buffer.
uint16_t uip_tcpchksum ( void  )

Calculate the TCP checksum of the packet in uip_buf and uip_appdata.

The TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.

Returns:
The TCP checksum of the TCP segment in uip_buf and pointed to by uip_appdata.
uint16_t uip_udpchksum ( void  )

Calculate the UDP checksum of the packet in uip_buf and uip_appdata.

The UDP checksum is the Internet checksum of data contents of the UDP segment, and a pseudo-header as defined in RFC768.

Note:
The uip_appdata pointer that points to the packet data may point anywhere in memory, so it is not possible to simply calculate the Internet checksum of the contents of the uip_buf buffer.
Returns:
The UDP checksum of the UDP segment in uip_buf and pointed to by uip_appdata.
void uipSecTick ( void  )

One second tick for the uiP stack.

This function has to be called by the runtime every second. (weAutSys does this in the 1s system thread.)

The implementation efficiently handles the ARP and DHCP timers.


Variable Documentation

void* uip_appdata

Pointer to the application data in the packet buffer.

This pointer points to the application data when the application is called. If the application wishes to send data, the application may use this space to write the data into before calling uip_send().

Examples:
main.c.

The (actual) MAC address.

It can be changed on initialisation and has to be held consistent with the ENC28J60's MAC setting.

This is the (one) MAC address used for the Ethernet link. It is to be known by the Ethernet stack uIP and by the driver (of ENC28J60).