2xs/smews — pull request #3 by hauspie (2012-06-18 16:01:38+00:00)
Title: Addition of a new kind of application to handle protocol other than TCP outside smews kernel

Genesis of the feature
=======================

This new feature emerged from a discussion between me and Gilles on how to correctly implement the ICMPv6 Neighbor Solicitation packets to finish the IPv6 port on the mbed ethernet target.

It has been clear to us that handling those messages should neither be in core nor in target specific code. Indeed, ICMPv6 should benefit more than just a target and is outside smews main core.

Thus, the decision was to implement a way for a developper to add a Smews application that has 2 handler functions and associate them to a IP protocol number (e.g. 1 for ICMPv4 or 58 for ICMPv6, 17 for UDP...). The functions are for processing input packets and generate an output.

Here is a sample XML header for this kind of generator:

How it is implemented
========================
A new type of output_handler has been defined. When a non TCP packet is processed in smews_receive, smews checks if a resource can handle the protocol number. Is so, it call the dopacketin associated to the resource. If this function returns 1, smews creates a new connection and adds it to the connection list. The output callback is then later called in smews_send.

The connection structure has been modified to separate strict tcp/http values of IP ones. the old http_connection is now a part of it as a C union with another new gpip_connection.
The newly created connection is removed as soon as the output packet has been transmitted.