mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Rename bro_version and BRO_PLUGIN_BRO_VERSION to zeek names
This commit is contained in:
parent
25c63ed7ab
commit
a9328b5c44
3 changed files with 79 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "zeek/zeek-config.h"
|
||||
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
@ -12,7 +13,9 @@
|
|||
#include "zeek/ZeekArgs.h"
|
||||
#include "zeek/logging/WriterBackend.h"
|
||||
|
||||
#define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION
|
||||
// Remove the BRO define in v6.1.
|
||||
#define BRO_PLUGIN_BRO_VERSION ZEEK_VERSION_FUNCTION
|
||||
#define ZEEK_PLUGIN_ZEEK_VERSION ZEEK_VERSION_FUNCTION
|
||||
|
||||
namespace zeek::threading
|
||||
{
|
||||
|
@ -113,13 +116,82 @@ public:
|
|||
// 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)) { bro_version = BRO_PLUGIN_BRO_VERSION; }
|
||||
inline Configuration() __attribute__((always_inline))
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
bro_version = ZEEK_PLUGIN_ZEEK_VERSION;
|
||||
#pragma GCC diagnostic pop
|
||||
zeek_version = ZEEK_PLUGIN_ZEEK_VERSION;
|
||||
}
|
||||
|
||||
Configuration(Configuration&& c)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
bro_version = std::move(c.bro_version);
|
||||
#pragma GCC diagnostic pop
|
||||
zeek_version = std::move(c.zeek_version);
|
||||
|
||||
name = std::move(c.name);
|
||||
description = std::move(c.description);
|
||||
version = std::move(c.version);
|
||||
}
|
||||
|
||||
Configuration(const Configuration& c)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
bro_version = c.bro_version;
|
||||
#pragma GCC diagnostic pop
|
||||
zeek_version = c.zeek_version;
|
||||
|
||||
name = c.name;
|
||||
description = c.description;
|
||||
version = c.version;
|
||||
}
|
||||
|
||||
Configuration& operator=(Configuration&& c)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
bro_version = std::move(c.bro_version);
|
||||
#pragma GCC diagnostic pop
|
||||
zeek_version = std::move(c.zeek_version);
|
||||
|
||||
name = std::move(c.name);
|
||||
description = std::move(c.description);
|
||||
version = std::move(c.version);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Configuration& operator=(const Configuration& c)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
bro_version = c.bro_version;
|
||||
#pragma GCC diagnostic pop
|
||||
zeek_version = c.zeek_version;
|
||||
|
||||
name = c.name;
|
||||
description = c.description;
|
||||
version = c.version;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* One can assign BRO_PLUGIN_BRO_VERSION to this to catch
|
||||
* One can assign ZEEK_PLUGIN_ZEEK_VERSION to this to catch
|
||||
* version mismatches at link(!) time.
|
||||
*/
|
||||
const char* (*bro_version)();
|
||||
[[deprecated("Remove in v6.1. Use zeek_version.")]] std::function<const char*()> bro_version;
|
||||
|
||||
/**
|
||||
* One can assign ZEEK_PLUGIN_ZEEK_VERSION to this to catch
|
||||
* version mismatches at link(!) time.
|
||||
*/
|
||||
std::function<const char*()> zeek_version;
|
||||
|
||||
private:
|
||||
friend class Plugin;
|
||||
|
|
|
@ -7,7 +7,7 @@ char version[] = "@VERSION@";
|
|||
// One can link a shared library against this to ensure that it won't
|
||||
// load if the version of the main Zeek binary differs compared to
|
||||
// what the library was compiled against.
|
||||
const char* BRO_VERSION_FUNCTION()
|
||||
const char* ZEEK_VERSION_FUNCTION()
|
||||
{
|
||||
return "@VERSION_C_IDENT@";
|
||||
}
|
||||
|
|
|
@ -246,11 +246,11 @@
|
|||
#endif
|
||||
|
||||
/* A C function that has the Zeek version encoded into its name. */
|
||||
#define BRO_VERSION_FUNCTION bro_version_@VERSION_C_IDENT@
|
||||
#define ZEEK_VERSION_FUNCTION zeek_version_@VERSION_C_IDENT@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern const char* BRO_VERSION_FUNCTION();
|
||||
extern const char* ZEEK_VERSION_FUNCTION();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue