mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Deprecate plugin::HookType and plugin::component::Type in a different way
This commit is contained in:
parent
7ee8e11a8f
commit
b1b1ec5171
8 changed files with 65 additions and 233 deletions
|
@ -17,14 +17,6 @@ Component::Component(zeek::plugin::component::Type type, const std::string& name
|
|||
{
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
Component::Component(plugin::component::Type type, const std::string& name)
|
||||
: plugin::Component(static_cast<zeek::plugin::component::Type>(type), name)
|
||||
{
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
Component::~Component()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -44,20 +44,6 @@ protected:
|
|||
* be unique across all components of this type.
|
||||
*/
|
||||
Component(zeek::plugin::component::Type type, const std::string& name);
|
||||
|
||||
/**
|
||||
* Constructor to use by derived classes.
|
||||
*
|
||||
* @param type The type of the componnent.
|
||||
*
|
||||
* @param name A descriptive name for the component. This name must
|
||||
* be unique across all components of this type.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::component::Type instead")]]
|
||||
Component(plugin::component::Type type, const std::string& name);
|
||||
#pragma GCC diagnostic pop
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,16 +14,6 @@ Component::Component(component::Type arg_type, const std::string& arg_name)
|
|||
canon_name = canonify_name(name);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
Component::Component(::plugin::component::Type arg_type, const std::string& arg_name)
|
||||
{
|
||||
type = static_cast<component::Type>(arg_type);
|
||||
name = arg_name;
|
||||
canon_name = canonify_name(name);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
Component::~Component()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -6,20 +6,6 @@
|
|||
|
||||
class ODesc;
|
||||
|
||||
namespace plugin::component {
|
||||
|
||||
enum [[deprecated("Remove in v4.1. Use zeek::plugin::component::Type instead.")]] Type {
|
||||
READER, /// An input reader (not currently used).
|
||||
WRITER, /// A logging writer (not currenly used).
|
||||
ANALYZER, /// A protocol analyzer.
|
||||
FILE_ANALYZER, /// A file analyzer.
|
||||
IOSOURCE, /// An I/O source, excluding packet sources.
|
||||
PKTSRC, /// A packet source.
|
||||
PKTDUMPER /// A packet dumper.
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace zeek::plugin {
|
||||
|
||||
namespace component {
|
||||
|
@ -37,7 +23,7 @@ enum Type {
|
|||
PKTDUMPER /// A packet dumper.
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace component
|
||||
|
||||
/**
|
||||
* Base class for plugin components. A component is a specific piece of
|
||||
|
@ -57,20 +43,6 @@ public:
|
|||
*/
|
||||
Component(component::Type type, const std::string& name);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param type The type of the compoment.
|
||||
*
|
||||
* @param name A descriptive name for the component. This name must
|
||||
* be unique across all components of the same type.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::component::Type instead")]]
|
||||
Component(::plugin::component::Type type, const std::string& name);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
|
@ -137,4 +109,25 @@ private:
|
|||
namespace plugin
|
||||
{
|
||||
using Component [[deprecated("Remove in v4.1. Use zeek::plugin::Component instead.")]] = zeek::plugin::Component;
|
||||
}
|
||||
|
||||
namespace component
|
||||
{
|
||||
|
||||
using Type [[deprecated("Remove in v4.1. Use zeek::plugin::component::Type instead.")]] = zeek::plugin::component::Type;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::READER instead.")]]
|
||||
constexpr auto READER = zeek::plugin::component::READER;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::WRITER instead.")]]
|
||||
constexpr auto WRITER = zeek::plugin::component::WRITER;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::ANALYZER instead.")]]
|
||||
constexpr auto ANALYZER = zeek::plugin::component::ANALYZER;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::FILE_ANALYZER instead.")]]
|
||||
constexpr auto FILE_ANALYZER = zeek::plugin::component::FILE_ANALYZER;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::IOSOURCE instead.")]]
|
||||
constexpr auto IOSOURCE = zeek::plugin::component::IOSOURCE;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::PKTSRC instead.")]]
|
||||
constexpr auto PKTSRC = zeek::plugin::component::PKTSRC;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::component::PKTDUMPER instead.")]]
|
||||
constexpr auto PKTDUMPER = zeek::plugin::component::PKTDUMPER;
|
||||
|
||||
} // namespace component
|
||||
} // namespace plugin
|
||||
|
|
|
@ -571,19 +571,6 @@ void Manager::DisableHook(zeek::plugin::HookType hook, Plugin* plugin)
|
|||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
void Manager::EnableHook(::plugin::HookType hook, Plugin* plugin, int prio)
|
||||
{
|
||||
EnableHook(static_cast<zeek::plugin::HookType>(hook), plugin, prio);
|
||||
}
|
||||
|
||||
void Manager::DisableHook(::plugin::HookType hook, Plugin* plugin)
|
||||
{
|
||||
DisableHook(static_cast<zeek::plugin::HookType>(hook), plugin);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void Manager::RequestEvent(EventHandlerPtr handler, Plugin* plugin)
|
||||
{
|
||||
DBG_LOG(DBG_PLUGINS, "Plugin %s requested event %s",
|
||||
|
|
|
@ -171,16 +171,6 @@ public:
|
|||
return hooks[hook] != nullptr;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
|
||||
bool HavePluginForHook(::plugin::HookType hook) const
|
||||
{
|
||||
// Inline to avoid the function call.
|
||||
return HavePluginForHook(static_cast<zeek::plugin::HookType>(hook));
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* Returns all the hooks, with their priorities, that are currently
|
||||
* enabled for a given plugin.
|
||||
|
@ -209,15 +199,6 @@ public:
|
|||
*/
|
||||
void DisableHook(zeek::plugin::HookType hook, Plugin* plugin);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
|
||||
void EnableHook(::plugin::HookType hook, Plugin* plugin, int prio);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin::HookType")]]
|
||||
void DisableHook(::plugin::HookType hook, Plugin* plugin);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* Registers interest in an event by a plugin, even if there's no handler
|
||||
* for it. Normally a plugin receives events through HookQueueEvent()
|
||||
|
|
|
@ -42,14 +42,6 @@ static constexpr const char* hook_names[int(zeek::plugin::NUM_HOOKS) + 1] = {
|
|||
return hook_names[int(h)];
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
const char* plugin::hook_name(::plugin::HookType h)
|
||||
{
|
||||
return hook_name(static_cast<zeek::plugin::HookType>(h));
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
BifItem::BifItem(const std::string& arg_id, Type arg_type)
|
||||
{
|
||||
id = arg_id;
|
||||
|
@ -358,19 +350,6 @@ Plugin::hook_list Plugin::EnabledHooks() const
|
|||
return plugin_mgr->HooksEnabledForPlugin(this);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
void Plugin::EnableHook(::plugin::HookType hook, int priority)
|
||||
{
|
||||
plugin_mgr->EnableHook(static_cast<zeek::plugin::HookType>(hook), this, priority);
|
||||
}
|
||||
|
||||
void Plugin::DisableHook(::plugin::HookType hook)
|
||||
{
|
||||
plugin_mgr->DisableHook(static_cast<zeek::plugin::HookType>(hook), this);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void Plugin::EnableHook(zeek::plugin::HookType hook, int priority)
|
||||
{
|
||||
plugin_mgr->EnableHook(hook, this, priority);
|
||||
|
@ -467,31 +446,12 @@ bool Plugin::HookReporter(const std::string& prefix, const EventHandlerPtr event
|
|||
return true;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
void Plugin::MetaHookPre(::plugin::HookType hook, const HookArgumentList& args)
|
||||
{
|
||||
}
|
||||
|
||||
void Plugin::MetaHookPost(::plugin::HookType hook, const HookArgumentList& args, HookArgument result)
|
||||
{
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void Plugin::MetaHookPre(zeek::plugin::HookType hook, const HookArgumentList& args)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
MetaHookPre(static_cast<::plugin::HookType>(hook), args);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
void Plugin::MetaHookPost(zeek::plugin::HookType hook, const HookArgumentList& args, HookArgument result)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
MetaHookPost(static_cast<::plugin::HookType>(hook), args, result);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
void Plugin::InitializeComponents()
|
||||
|
|
|
@ -26,44 +26,6 @@ namespace threading {
|
|||
struct Field;
|
||||
}
|
||||
|
||||
namespace plugin {
|
||||
|
||||
/**
|
||||
* Hook types that a plugin may define. Each label maps to the corresponding
|
||||
* virtual method in \a Plugin.
|
||||
*/
|
||||
enum [[deprecated("Remove in v4.1. Use the zeek::plugin::HookType instead.")]] HookType {
|
||||
// Note: when changing this table, update hook_name() in Plugin.cc.
|
||||
HOOK_LOAD_FILE, //< Activates Plugin::HookLoadFile().
|
||||
HOOK_CALL_FUNCTION, //< Activates Plugin::HookCallFunction().
|
||||
HOOK_QUEUE_EVENT, //< Activates Plugin::HookQueueEvent().
|
||||
HOOK_DRAIN_EVENTS, //< Activates Plugin::HookDrainEvents()
|
||||
HOOK_UPDATE_NETWORK_TIME, //< Activates Plugin::HookUpdateNetworkTime.
|
||||
HOOK_BRO_OBJ_DTOR, //< Activates Plugin::HookBroObjDtor.
|
||||
HOOK_SETUP_ANALYZER_TREE, //< Activates Plugin::HookAddToAnalyzerTree
|
||||
HOOK_LOG_INIT, //< Activates Plugin::HookLogInit
|
||||
HOOK_LOG_WRITE, //< Activates Plugin::HookLogWrite
|
||||
HOOK_REPORTER, //< Activates Plugin::HookReporter
|
||||
|
||||
// Meta hooks.
|
||||
META_HOOK_PRE, //< Activates Plugin::MetaHookPre().
|
||||
META_HOOK_POST, //< Activates Plugin::MetaHookPost().
|
||||
|
||||
// End marker.
|
||||
NUM_HOOKS,
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a hook type into a readable hook name.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
|
||||
extern const char* hook_name(::plugin::HookType h);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
}
|
||||
|
||||
namespace zeek::plugin {
|
||||
|
||||
class Manager;
|
||||
|
@ -628,15 +590,6 @@ protected:
|
|||
*/
|
||||
void DisableHook(zeek::plugin::HookType hook);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
|
||||
void EnableHook(::plugin::HookType hook, int priority = 0);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
|
||||
void DisableHook(::plugin::HookType hook);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* Returns a list of hooks that are currently enabled for the plugin,
|
||||
* along with their priorities.
|
||||
|
@ -875,46 +828,7 @@ protected:
|
|||
bool time, const std::string& message);
|
||||
|
||||
// Meta hooks.
|
||||
|
||||
/**
|
||||
* A meta hook called just before another hook gets to execute. This
|
||||
* will be called independent of whether there's an implementation
|
||||
* for the hook.
|
||||
*
|
||||
* hook: The name of the hook about the execute. This will be the
|
||||
* same as the corresponding method name (e.g., \c HookQueueEvent).
|
||||
*
|
||||
* hook: The type of the hook about to execute.
|
||||
*
|
||||
* args: A list of the hooks arguments.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
|
||||
virtual void MetaHookPre(::plugin::HookType hook, const HookArgumentList& args);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
virtual void MetaHookPre(zeek::plugin::HookType hook, const HookArgumentList& args);
|
||||
|
||||
/**
|
||||
* A meta hook called just after another hook got to execute. This
|
||||
* will be called independent of whether there's an implementation
|
||||
* for the hook.
|
||||
*
|
||||
* hook: The type of the hook that finished executing.
|
||||
*
|
||||
* args: A list of the hooks arguments.
|
||||
*
|
||||
* result: The result that executing the hook returned. If there's no
|
||||
* implementation for the hook, this will be the default result. If
|
||||
* the hook doesn't yield a result, this will be of type VOID.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[deprecated("Remove in v4.1. Use the version that takes zeek::plugin:HookType instead.")]]
|
||||
virtual void MetaHookPost(::plugin::HookType hook, const HookArgumentList& args, HookArgument result);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
virtual void MetaHookPost(zeek::plugin::HookType hook, const HookArgumentList& args, HookArgument result);
|
||||
|
||||
private:
|
||||
|
@ -969,13 +883,42 @@ private:
|
|||
bif_item_list bif_items; // BiF items the plugin provides.
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace zeek::plugin
|
||||
|
||||
namespace plugin {
|
||||
|
||||
using VersionNumber [[deprecated("Remove in v4.1. Use zeek::plugin::VersionNumber instead")]] = zeek::plugin::VersionNumber;
|
||||
using Configuration [[deprecated("Remove in v4.1. Use zeek::plugin::Configuration instead")]] = zeek::plugin::Configuration;
|
||||
using BifItem [[deprecated("Remove in v4.1. Use zeek::plugin::BifItem instead")]] = zeek::plugin::BifItem;
|
||||
using HookArgument [[deprecated("Remove in v4.1. Use zeek::plugin::HookArgument instead")]] = zeek::plugin::HookArgument;
|
||||
using HookArgumentList [[deprecated("Remove in v4.1. Use zeek::plugin::HookArgumentList instead")]] = zeek::plugin::HookArgumentList;
|
||||
using Plugin [[deprecated("Remove in v4.1. Use zeek::plugin::Plugin instead")]] = zeek::plugin::Plugin;
|
||||
}
|
||||
|
||||
using HookType [[deprecated("Remove in v4.1. Use the zeek::plugin::HookType instead.")]] = zeek::plugin::HookType;
|
||||
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_LOAD_FILE instead.")]]
|
||||
constexpr auto HOOK_LOAD_FILE = zeek::plugin::HOOK_LOAD_FILE;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_CALL_FUNCTION instead.")]]
|
||||
constexpr auto HOOK_CALL_FUNCTION = zeek::plugin::HOOK_CALL_FUNCTION;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_QUEUE_EVENT instead.")]]
|
||||
constexpr auto HOOK_QUEUE_EVENT = zeek::plugin::HOOK_QUEUE_EVENT;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_DRAIN_EVENTS instead.")]]
|
||||
constexpr auto HOOK_DRAIN_EVENTS = zeek::plugin::HOOK_DRAIN_EVENTS;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_UPDATE_NETWORK_TIME instead.")]]
|
||||
constexpr auto HOOK_UPDATE_NETWORK_TIME = zeek::plugin::HOOK_UPDATE_NETWORK_TIME;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_BRO_OBJ_DTOR instead.")]]
|
||||
constexpr auto HOOK_BRO_OBJ_DTOR = zeek::plugin::HOOK_BRO_OBJ_DTOR;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_SETUP_ANALYZER_TREE instead.")]]
|
||||
constexpr auto HOOK_SETUP_ANALYZER_TREE = zeek::plugin::HOOK_SETUP_ANALYZER_TREE;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_LOG_INIT instead.")]]
|
||||
constexpr auto HOOK_LOG_INIT = zeek::plugin::HOOK_LOG_INIT;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_LOG_WRITE instead.")]]
|
||||
constexpr auto HOOK_LOG_WRITE = zeek::plugin::HOOK_LOG_WRITE;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::HOOK_REPORTER instead.")]]
|
||||
constexpr auto HOOK_REPORTER = zeek::plugin::HOOK_REPORTER;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::META_HOOK_PRE instead.")]]
|
||||
constexpr auto META_HOOK_PRE = zeek::plugin::META_HOOK_PRE;
|
||||
[[deprecated("Remove in v4.1. Use zeek::plugin::META_HOOK_POST instead.")]]
|
||||
constexpr auto META_HOOK_POST = zeek::plugin::META_HOOK_POST;
|
||||
|
||||
} // namespace plugin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue