Running the uIP TCP/IP stack on EPOS

Author: Rodrigo V. Raimundo (rodrigovr@lisha.ufsc.br)

* Introduction

uIP is a TCP/IP stack developed by Adam Dunkels and freely available
at http://www.sics.se/~adam/uip/index.php/Main_Page

uIP goal is minimum memory overhead. All data is global and there is
not dynamic allocation at all.

The stack needs to run as a "main loop" inside some thread but the
uIP code is not thread-safe and is event-driven. There are two sources
of events: the network card and a periodic timer set to 500ms.

Included demo applications use the psock library and protothreads.
Protothreads are not threads, but the programming style is similar
to programming with threads (there are join, wait, yield, ...).

* Installing

1. Copy the uip directory to epos/include/uip.

2. Copy the demo application (webserver + dhcp client) uip_test.cc
to epos/app/uip_test.cc

3. Apply the epos_uIP.patch inside the directory epos/ using:
patch -p0 < epos_uIP.patch

Build everything and run: make veryclean && make && make run

QEMU will forward localhost:8080 port to EPOS :80, so you can 
see if everything worked.


* Porting

If you wish to run the stack on other machines you need
to create 2 methods on your NIC (raw_send and raw_receive).
These methods should deliver/receive data without encapsulation
or should translate to/from ethernet encapsulation since
uIP packs everything as ethernet frames.

Tweak include/traits.h Traits<IP> to your needs. BUFFER_SIZE should
be less than or equal to your NIC's MTU.
