> > But you have to have a rule somewhere in order to know what protocol you = > > have > > just decapsulated so you know what module you want to talk to. > > So in that case, either the rules would be something separate (e.g. some = > > kind > > of recognition library), or it would be in the lower layer. > > In that case, if you want to add IPv6 for example, you have to update the= > > > > ethernet layer or the recognition library (with the new rule) *and* add = > > an > > IPv6 module. While if you have a GimmeYourRule function you can call, you= > > can > > only add an IPv6 module and you don't have to update the ethernet module.= > > > > Or ethernet nic can receive a frame containing IPv6 packet (determined > by the proto ID) in the ethernet frame; > > then the ethernet module can check if IPv6 handling module is > registered and if it is pass the packet to this module; if not it can > just drop the frame; Exactly. > > the same continues up the network stack (IPv6 module checks what > protocol data unit it carries and forwards it to the appropriate > module, etc) > > This way we will need a list of registered protocols and pointers to > functions that handle input/output for each of them. > In fact every module will need to export at least three functions: > init, recive and transmit. Well, and stop. Still not a big deal is it? This is the sort of flexability i'd like to see. I can knock up a new proto module, drop it in, restart and away it goes. It adds itself to the list of protos and if I get packets that it can deal with, it does! david