contiki-os/contiki — pull request #585 by g-oikonomou (2014-03-05 23:29:40+00:00)
Title: Generic ICMPv6 input hooks / Do NOT merge

Bit of a pain in the backside to add a new #if block for every new ICMPv6 message type, and that switch statement in `uip6.c` had started growing too long anyway.

This pull implements a way to handle incoming ICMPv6 datagrams in a generic fashion, by associating a function pointer (handler) for each type/code combination (code can be "don't care").

* From now on, adding support for new ICMPv6 messages to the core is as simple as a call to `uip_icmp6_register_input_handler`
* Shortens `uip_process` and improves its readability
* In the longer term, more efficient in terms of code footprint

Please have a look at this, *do not merge - this is untested*, I just want to gauge interest at this stage. I'm demonstrating using echo requests and RPL ICMPv6 messages as an example. If this is a desirable feature, I'll extend it for ND messages and give it appropriate testing.

Extremely unscientific experiments below: We lose out a bit in terms of code footprint and memory usage due to the new functions and LIST/MEMB required to store handlers. However, after I'm done with ND and once we start getting multicast stuff in (MPL / MLD), the loss will decrease and may even start becoming a gain.

On master:
```
$ arm-none-eabi-size unicast-receiver.cc2538dk
text	data	bss	dec	hex	filename
42604	390	14614	57608	e108	unicast-receiver.cc2538dk
```

On the branch:
```
$ arm-none-eabi-size unicast-receiver.cc2538dk
text	data	bss	dec	hex	filename
42892	402	14722	58016	e2a0	unicast-receiver.cc2538dk
```

Looking forward to your thoughts.