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 UIP_APPDATA_SIZE |
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.
void uip_process | ( | uint8_t | flag | ) |
The actual uIP function which does all the work.
flag | says 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.
buf | A pointer to the buffer over which the checksum is to be computed. |
len | The length of the buffer over which the checksum is to be computed. |
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.
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.
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.
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.
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().
struct uip_eth_addr actMACadd |
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).