mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Add hook 'HookAddToAnalyzerTree' to support TCPRS plugin
This commit introduces a new hook, HookAddToAnalyzerTree, which allows plugins to add a new analyzer to the analyzer tree during analyzer tree creation. This hook is necessary to support the TCPRS plugin. Additionally, the order in which the scripts were loaded has been changed to address a problem with undefined variable errors due to load order issues. Signed-off-by: James Swaro <james.swaro@gmail.com>
This commit is contained in:
parent
30bb17ea8d
commit
85fd1c9fa7
5 changed files with 43 additions and 3 deletions
|
@ -183,8 +183,9 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
|
|||
}
|
||||
|
||||
// Load {bif,scripts}/__load__.bro automatically.
|
||||
|
||||
string init = dir + "lib/bif/__load__.bro";
|
||||
// Load scripts/__load__.bro first to avoid issue with undefined variables
|
||||
// from the plugin
|
||||
string init = dir + "scripts/__load__.bro";
|
||||
|
||||
if ( is_file(init) )
|
||||
{
|
||||
|
@ -192,7 +193,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
|
|||
scripts_to_load.push_back(init);
|
||||
}
|
||||
|
||||
init = dir + "scripts/__load__.bro";
|
||||
init = dir + "lib/bif/__load__.bro";
|
||||
|
||||
if ( is_file(init) )
|
||||
{
|
||||
|
@ -660,6 +661,33 @@ void Manager::HookDrainEvents() const
|
|||
|
||||
}
|
||||
|
||||
void Manager::HookAddToAnalyzerTree(Connection *conn) const
|
||||
{
|
||||
HookArgumentList args;
|
||||
|
||||
if ( HavePluginForHook(META_HOOK_PRE) )
|
||||
{
|
||||
args.push_back(conn);
|
||||
MetaHookPre(HOOK_ADD_TO_ANALYZER_TREE, args);
|
||||
}
|
||||
|
||||
hook_list *l = hooks[HOOK_ADD_TO_ANALYZER_TREE];
|
||||
|
||||
if ( l )
|
||||
{
|
||||
for (hook_list::iterator i = l->begin() ; i != l->end(); ++i)
|
||||
{
|
||||
Plugin *p = (*i).second;
|
||||
p->HookAddToAnalyzerTree(conn);
|
||||
}
|
||||
}
|
||||
|
||||
if ( HavePluginForHook(META_HOOK_POST) )
|
||||
{
|
||||
MetaHookPost(HOOK_ADD_TO_ANALYZER_TREE, args, HookArgument());
|
||||
}
|
||||
}
|
||||
|
||||
void Manager::HookUpdateNetworkTime(double network_time) const
|
||||
{
|
||||
HookArgumentList args;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue