[Openvas-devel] (Better) Naming Conventions for libraries and includes

Jan-Oliver Wagner Jan-Oliver.Wagner at greenbone.net
Fri Sep 18 16:43:55 CEST 2009

On Freitag, 18. September 2009, Matthew Mundell wrote:
> > In current trunk, openvas-libraries builds a couple of libraries (e.g.
> > libopenvasmisc, libopenvashg, libopenvas_base and libopenvas_nasl).
> > Should(nt) we consistently use underscores to separate the "sub" libraries?
> libopenvasmisc and libopenvashg will go away eventually, so I think this is
> OK, as long as all new libraries have underscores.

it still could be a long time until then. I favour very much consistency.
Also, underscoring would clearly mark the big library change from 2.0 to 3.0
and avoid any confusion beyond so version.

> > We are also somewhat messy regarding the includes of files from outside the
> > module, like
> > #include "whatever.h"
> > #include <whatever.h>
> > #include <openvas/whatever.h>.
> > Currently all headers are installed to (include/)openvas, but it makes sense
> > to make clear to which module the files belong and to avoid clashes (e.g.
> > omp.h for the OpenVAS Manager Protocol and not OpenMP).
> >
> > So we could install the headers from openvas-libraries/base to
> >  (include/)openvas/base
> > and include e.g. via
> > #include <openvas/base/nvti.h>

this would be cleanest of all approaches.
Moving a header from one lib to another would
require to adjust in all files including it. But
this should not happen anyway for stable versions.

> Yeah, I think this is a good idea.  Alternatives would be
> 	#include <openvas/nvti.h>

that would be my minimum requirement but my real
preference is the one above.
> or
> 	#include <openvas_nvti.h>.

I don't like this!
> Some of the library header names are currently preceded with openvas_, like
> openvas_auth.h.

In fact, with the consisten openvas/... approach we would not need
such prefixes anymore.
> A related issue is the naming of the symbols in the libraries.  Perhaps we
> could agree on a prefix for all library symbols?  Maybe openvas_, ov_,
> openvas_module_ or ov_module, as in
> 	openvas_nvti_new
> 	ov_nvti_new
> 	openvas_base_nvti_new
> 	ov_base_nvti_new
> Including the module name might result in some very long names, though.

Is it really a good idea to prefix any of our library functions?

However, indeed currently, different names schemes are used and that
isn't really consistent either.



Dr. Jan-Oliver Wagner |  ++49-541-335084-0  |  http://www.greenbone.net/
Greenbone Networks GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B 202460
Geschäftsführer: Lukas Grunwald, Dr. Jan-Oliver Wagner

More information about the Openvas-devel mailing list