mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/robin/gh-3573-replaces-cleanup'
* origin/topic/robin/gh-3573-replaces-cleanup: Fix packet analyzer replacement. Spicy: Wenn replacing an analyzer add a component mapping. Add component API to transparently remap one component to another one. Move enabled/disabled functionality from analyzers into `Component` base class API.
This commit is contained in:
commit
8ce3c877ff
20 changed files with 227 additions and 145 deletions
|
@ -11,7 +11,7 @@ namespace zeek::file_analysis {
|
|||
Component::Component(const std::string& name, factory_function arg_factory, Tag::subtype_t subtype, bool arg_enabled)
|
||||
: plugin::Component(plugin::component::FILE_ANALYZER, name, subtype, file_mgr->GetTagType()) {
|
||||
factory_func = arg_factory;
|
||||
enabled = arg_enabled;
|
||||
SetEnabled(arg_enabled);
|
||||
}
|
||||
|
||||
void Component::Initialize() {
|
||||
|
@ -26,7 +26,7 @@ void Component::DoDescribe(ODesc* d) const {
|
|||
d->Add(", ");
|
||||
}
|
||||
|
||||
d->Add(enabled ? "enabled" : "disabled");
|
||||
d->Add(Enabled() ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
} // namespace zeek::file_analysis
|
||||
|
|
|
@ -70,20 +70,6 @@ public:
|
|||
*/
|
||||
factory_function FactoryFunction() const { return factory_func; }
|
||||
|
||||
/**
|
||||
* Returns true if the analyzer is currently enabled and hence
|
||||
* available for use.
|
||||
*/
|
||||
bool Enabled() const { return enabled; }
|
||||
|
||||
/**
|
||||
* Enables or disables this analyzer.
|
||||
*
|
||||
* @param arg_enabled True to enabled, false to disable.
|
||||
*
|
||||
*/
|
||||
void SetEnabled(bool arg_enabled) { enabled = arg_enabled; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Overridden from plugin::Component.
|
||||
|
@ -94,7 +80,6 @@ private:
|
|||
friend class Manager;
|
||||
|
||||
factory_function factory_func; // The analyzer's factory callback.
|
||||
bool enabled; // True if the analyzer is enabled.
|
||||
};
|
||||
|
||||
} // namespace file_analysis
|
||||
|
|
|
@ -41,7 +41,7 @@ function Files::__set_reassembly_buffer%(file_id: string, max: count%): bool
|
|||
## :zeek:see:`Files::enable_analyzer`.
|
||||
function Files::__enable_analyzer%(tag: Files::Tag%) : bool
|
||||
%{
|
||||
auto c = zeek::file_mgr->Lookup(tag->AsEnumVal());
|
||||
auto c = zeek::file_mgr->Lookup(tag->AsEnumVal(), false);
|
||||
|
||||
if ( ! c )
|
||||
return zeek::val_mgr->False();
|
||||
|
@ -53,7 +53,7 @@ function Files::__enable_analyzer%(tag: Files::Tag%) : bool
|
|||
## :zeek:see:`Files::disable_analyzer`.
|
||||
function Files::__disable_analyzer%(tag: Files::Tag%) : bool
|
||||
%{
|
||||
auto c = zeek::file_mgr->Lookup(tag->AsEnumVal());
|
||||
auto c = zeek::file_mgr->Lookup(tag->AsEnumVal(), false);
|
||||
|
||||
if ( ! c )
|
||||
return zeek::val_mgr->False();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue