[Openvas-devel] (Better) Naming Conventions for libraries and includes
Matthew Mundell
matthew.mundell at intevation.de
Fri Sep 18 10:53:56 CEST 2009
> We need some conventions for our libraries and includes.
>
> libs
> ----
> 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.
> includes
> --------
> 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>
> .
Yeah, I think this is a good idea. Alternatives would be
#include <openvas/nvti.h>
or
#include <openvas_nvti.h>.
Some of the library header names are currently preceded with openvas_, like
openvas_auth.h.
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.
More information about the Openvas-devel
mailing list