Reworking plugin interface to not rely on macros.

The Plugin.cc file is now just a standard class, with the interface
changed a bit to make it more easy to write. However, there're still
some conventions that one must follow to make everything work (like
using the right namespace structure).

This commit also includes the option to compile built-in plugins
dynamically instead of statically by adding
SET(BRO_PLUGIN_BUILD_DYNAMIC TRUE) to their CMake config. This hasn't
been tested much yet, and I'm still undecided if it's somethign we
would want to do by default--but we could now if wanted. :)

Also some minor other cleanup of plugin APIs and built infrastructure.

All tested on MacOS only currently.
This commit is contained in:
Robin Sommer 2014-01-18 22:06:30 +01:00
parent 9227a57935
commit ea01a1be30
21 changed files with 273 additions and 333 deletions

View file

@ -98,20 +98,20 @@ option:
That looks quite good, except for the dummy description that we should
replace with something nicer so that users will know what our plugin
is about. We do this by editing the ``BRO_PLUGIN_DESCRIPTION`` line
in ``src/Plugin.cc``, like this:
is about. We do this by editing the ``config.description`` line in
``src/Plugin.cc``, like this:
# cat src/Plugin.cc
#include <plugin/Plugin.h>
BRO_PLUGIN_BEGIN(Demo, Rot13)
BRO_PLUGIN_VERSION(1);
BRO_PLUGIN_DESCRIPTION("Caesar cipher rotating a string's characters by 13 places.");
BRO_PLUGIN_BIF_FILE(consts);
BRO_PLUGIN_BIF_FILE(events);
BRO_PLUGIN_BIF_FILE(functions);
BRO_PLUGIN_END
[...]
plugin::Configuration Configure()
{
plugin::Configuration config;
config.name = "Demo::Rot13";
config.description = "Caesar cipher rotating a string's characters by 13 places.";
config.version.major = 1;
config.version.minor = 0;
return config;
}
[...]
# make
[...]