Adding plugin API number into versioned function name, and removing

old runtime API version check.
This commit is contained in:
Robin Sommer 2017-07-21 13:23:37 -07:00
parent 8ae30d8aac
commit 78f8ff432f
6 changed files with 10 additions and 35 deletions

View file

@ -243,10 +243,6 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
plugins_by_path.insert(std::make_pair(normalize_path(dir), current_plugin));
if ( current_plugin->APIVersion() != BRO_PLUGIN_API_VERSION )
reporter->FatalError("plugin's API version does not match Bro (expected %d, got %d in %s)",
BRO_PLUGIN_API_VERSION, current_plugin->APIVersion(), path);
// We execute the pre-script initialization here; this in
// fact could be *during* script initialization if we got
// triggered via @load-plugin.

View file

@ -242,11 +242,6 @@ VersionNumber Plugin::Version() const
return config.version;
}
int Plugin::APIVersion() const
{
return config.api_version;
}
bool Plugin::DynamicPlugin() const
{
return dynamic;

View file

@ -13,10 +13,9 @@
#include "iosource/Component.h"
#include "logging/WriterBackend.h"
// We allow to override this externally for testing purposes.
#ifndef BRO_PLUGIN_API_VERSION
#define BRO_PLUGIN_API_VERSION 5
#endif
// Increase this when making incompatible changes to the plugin API. Note
// that the constant is never used in C code. It's picked up on by CMake.
#define BRO_PLUGIN_API_VERSION 6
#define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION
@ -103,14 +102,12 @@ public:
private:
friend class Plugin;
int api_version; // Current BRO_PLUGIN_API_VERSION. Automatically set.
};
inline Configuration::Configuration()
{
name = "";
description = "";
api_version = BRO_PLUGIN_API_VERSION;
bro_version = 0;
}
@ -451,15 +448,6 @@ public:
**/
const std::string& PluginPath() const;
/**
* Returns the internal version of the Bro API that this plugin
* relies on. Only plugins that match Bro's current API version can
* be used. For statically compiled plugins this is automatically the
* case, but dynamically loaded plugins may cause a mismatch if they
* were compiled for a different Bro version.
*/
int APIVersion() const;
/**
* Returns a list of all components the plugin provides.
*/