lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Cleaner include handling / using pbuf standalone


From: address@hidden
Subject: Re: [lwip-devel] Cleaner include handling / using pbuf standalone
Date: Mon, 08 Feb 2010 17:12:53 +0100
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1

Am 08.02.10 15:50, schrieb Kieran Mansley:
On Mon, 2010-02-08 at 09:39 -0500, Bill Auerbach wrote:
I have 3 points on lwIP #includes I’d like to make and maybe see
improvements for:

1)      When I use other 3rd party libraries or code to include in a
project, I have rarely had to use anything but one search path in the
compiler options to have the compiler find all of the #include files.
With lwIP I find I have to add 3 or 4 search paths to the compiler
options.  It sure would be nice to have one, like “lwip/src/include”
and have that be all that’s required to find all of the files.
This is largely down to the way lwIP is distributed in two parts: the
core lwIP code and a system-dependent port.
Besides from the core/port issue there is the ipv4/v6 issue. This can currently only be solved by giving he headers different names (i.e. adding v4 or v6 to the names somewhere). Then there's the include/netif directory. This one could indeed be removed, I guess, since it only contains 3 files or so (note that the api headers are in the core include directory, too, so why not the netif headers).
You get header files from
the two halves.  Historically these have been kept in two separate
places in the filing system for simplicity of porting I suppose.
There's no reason why a port couldn't be done by putting all of its own
code in with the lwIP tree and so cut down on the locations of header
files, if you wanted to do things that way.
That won't work currently, as cc.h and sys_arch.h are incuded as "arch/cc.h" and "arch/sys_arch.h".
2)      I’m doing a new lwIP platform port and I want the low-level
hardware driver to be as standalone as possible.  The driver needs
only the struct pbuf declaration to be able to send and receive
packets.  So I added #include “pbuf.h”.  But it includes opts.h and
err.h.  pbuf.h only needs the type definitions.  It would be nice to
include only that file.  Doing this also shows point 1 above – I had
to add 4 search paths simply to include pbuf.h.
Can you give examples of what the four search paths you needed were?
opt.h and err.h should both be in the same location as pbuf.h
At least for the current CVS code, the directories containing pbuf.h and cc.h should be enough, I think, since neither netif- nor ipv4-headers are included by pbuf.h.
Splitting header files is usually a good idea so that code can just
import the actual bits it needs, but you reach a practical limit where
dependencies between header files get complex and cyclical.
Well, I do think there's some room for improvement in lwIP and I already improved a little. Especially tcp.h could be splitted into an external part (for applications) and an internal part (for the tcp implementation). Personally, I'm open to suggestions here.

Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]