[En-Nut-Discussion] RFC: Registering Protocols

Harald Kipp harald.kipp at egnite.de
Mon Aug 11 10:44:47 CEST 2008


Hi,

I need to implement a new Ethernet protocol
http://en.wikipedia.org/wiki/Data_Link_Control

Of course it must be avoided, that existing applications will suffer. No 
DLC code should be included if not used. One of the following techniques 
can be used to maintain this:

1. Using the Configurator to enable or disable a specific protocol.
2. Using NutRegisterXXX to create a reference.

Option 1 is easy to implement, but will clutter up the code ifdefs and 
requires re-compilation of the libraries for different applications.

Option 2 is more elegant, but someone needs to call the registering 
function.

An additional problem exists in the current code. If an application uses 
UDP only, it still gets the TCP routines linked in. That's because 
NutIpInput() refers to NutTcpInput().

After reconsidering the situation, I came to the conclusion that 
actually all networking applications will use IP and, if based on 
Ethernet, they need ARP as well. Furthermore, it is generally expected, 
that Nut/OS based nodes respond to ICMP echo requests. Registering these 
protocols would introduce additional code without benefit.

However, the IP protocols UDP and TCP should be optional, because some 
applications may use one of them only. The decision can be based on 
NutTcpCreateSocket() and NutUdpCreateSocket(). If any of these is called 
for the first time, they will register the related protocol in the IP layer.

The protocol switch in NutIpInput() will be partly (UDP, TCP, IGMP) 
replaced by a loop through a linked list of registered protocols.

Comments?

Harald

P.S.: Note, that more features are missing in the current layout of the 
low level Nut/Net routines: Supporting multiple concurrent interfaces, 
which can be dynamically configured, activated or shut down, and, when 
activated, sending out a gratuitous ARP on Ethernet. Furthermore, 
routing between interfaces will be required. Any new code should 
consider this.



More information about the En-Nut-Discussion mailing list