[ell-i-developers] Re: IP/UDP/CoAP status

  • From: Pekka Nikander <pekka.nikander@xxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Mon, 3 Mar 2014 17:37:00 +0200

ARP, IP, ICMP echo, UDP, and CoAP all now "work" in the emulator, as a 
baseline.  I'm now standing by for the ENC28J60 code, mostly thinking about how 
to clean up the protocol stack.

The current interface towards the hardware looks like the following:

When it has received a packet, the hardware shall call eth_input with a pointer 
to a buffer.  The buffer must start with the Ethernet header.  The buffer must 
contain the whole received packet, and is currently assumed to be at least 256 
bytes long (compile time constant). 

When the stack has processed the packet and wants to send a packet out, it 
calls eth_output, with a pointer to the Ethernet *payload* within the same 
buffer, and the payload length.  The hardware driver must implement this 
function.

At the moment eth_output is always called in the same context as when eth_input 
was called.  That will later change, when we implement DHCP, as it will send 
out packets on its own.  As a starting point, it is ok to call eth_input in the 
ENC28J60 interrupt context, but we must change also that later once we'll have 
threading working.

When eth_output is called, the hardware driver can safely assume the buffer to 
contain the Ethernet header just before the payload, and the total datagram 
length to be the Ethernet header length + the payload length.

See ethernet.h and eth_input.c for the code, in the feature-coap-wip branch in 
Runtime.git.

The local Ethernet address is assumed to be available through the 
ether_local_address global variable.  At the moment it is declared in 
eth_input.c, and initialised as all zeros.  That must be changed at some point 
but suffices for early testing.  Only ARP uses it; it is otherwise ignored by 
the stack.

--Pekka


Other related posts: