mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Merge remote-tracking branch 'origin/master' into topic/robin/reader-writer-plugins
This commit is contained in:
commit
0ba4b768cd
12 changed files with 107 additions and 60 deletions
|
@ -219,6 +219,10 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
|
|||
current_plugin->SetDynamic(true);
|
||||
current_plugin->DoConfigure();
|
||||
|
||||
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.
|
||||
|
|
|
@ -33,13 +33,6 @@ const char* plugin::hook_name(HookType h)
|
|||
return hook_names[int(h)];
|
||||
}
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
name = "";
|
||||
description = "";
|
||||
api_version = BRO_PLUGIN_API_VERSION;
|
||||
}
|
||||
|
||||
BifItem::BifItem(const std::string& arg_id, Type arg_type)
|
||||
{
|
||||
id = arg_id;
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
#include "analyzer/Component.h"
|
||||
#include "file_analysis/Component.h"
|
||||
|
||||
static const int BRO_PLUGIN_API_VERSION = 2;
|
||||
// We allow to override this externally for testing purposes.
|
||||
#ifndef BRO_PLUGIN_API_VERSION
|
||||
#define BRO_PLUGIN_API_VERSION 2
|
||||
#endif
|
||||
|
||||
class ODesc;
|
||||
class Func;
|
||||
|
@ -75,13 +78,23 @@ public:
|
|||
std::string description; //< A short textual description of the plugin. Mandatory.
|
||||
VersionNumber version; //< THe plugin's version. Optional.
|
||||
|
||||
Configuration();
|
||||
// We force this to inline so that the API version gets hardcoded
|
||||
// into the external plugin. (Technically, it's not a "force", just a
|
||||
// strong hint.). The attribute seems generally available.
|
||||
inline Configuration() __attribute__((always_inline));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class describing an item defined in \c *.bif file.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue