[openbeosnetteam] Re: Network stack question

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Wed, 04 Jul 2007 00:30:14 +0200 CEST

Ivo Vachkov <ivo@xxxxxxxxxxx> wrote:
> It all starts with ipv4_receive_data(); At the end we see:
>     return module->receive_data(buffer);
> Well, we can extend it like this:
> status_t st = module->receive_data(buffer);
> switch (st) {
>         net_protocol_module_info *m = 
> receiving_protocol(IPPROTO_ICMP);

I don't think that this is a good solution; you're mixing protocol 
depending things into the IP level. Instead, I would prefer if there 
would be a function in the protocol module that you can call for 
handling errors - and also one that will be called in case there were 
any errors.
But to improve planning, maybe it helps to list what kind of errors may 
occur, and how they should be resolved. Also how things like path MTU 
discovery may be implemented should be part of the planning process.

BTW, from the code snippet above, I strongly recommend to have a look 
at our coding style guide before you start coding: 
When in doubt, copying the style that is used throughout the stack now 
should help.


Other related posts: