mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Updating plugin hook test.
This commit is contained in:
parent
c24bb9cacd
commit
1c71832db1
3 changed files with 1380 additions and 1 deletions
1361
testing/btest/Baseline/plugins.hooks/output
Normal file
1361
testing/btest/Baseline/plugins.hooks/output
Normal file
File diff suppressed because it is too large
Load diff
|
@ -19,6 +19,7 @@ protected:
|
||||||
EnableHook(HOOK_UPDATE_NETWORK_TIME);
|
EnableHook(HOOK_UPDATE_NETWORK_TIME);
|
||||||
EnableHook(META_HOOK_PRE);
|
EnableHook(META_HOOK_PRE);
|
||||||
EnableHook(META_HOOK_POST);
|
EnableHook(META_HOOK_POST);
|
||||||
|
EnableHook(HOOK_BRO_OBJ_DTOR);
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Demo::Hooks";
|
config.name = "Demo::Hooks";
|
||||||
|
@ -33,6 +34,7 @@ protected:
|
||||||
virtual bool HookQueueEvent(Event* event);
|
virtual bool HookQueueEvent(Event* event);
|
||||||
virtual void HookDrainEvents();
|
virtual void HookDrainEvents();
|
||||||
virtual void HookUpdateNetworkTime(double network_time);
|
virtual void HookUpdateNetworkTime(double network_time);
|
||||||
|
virtual void HookBroObjDtor(void* obj);
|
||||||
virtual void MetaHookPre(HookType hook, const HookArgumentList& args);
|
virtual void MetaHookPre(HookType hook, const HookArgumentList& args);
|
||||||
virtual void MetaHookPost(HookType hook, const HookArgumentList& args, HookArgument result);
|
virtual void MetaHookPost(HookType hook, const HookArgumentList& args, HookArgument result);
|
||||||
|
|
||||||
|
@ -67,6 +69,7 @@ Val* Plugin::HookCallFunction(const Func* func, val_list* args)
|
||||||
HookArgument(args).Describe(&d);
|
HookArgument(args).Describe(&d);
|
||||||
fprintf(stderr, "%.6f %-15s %s\n", network_time, "| HookCallFunction",
|
fprintf(stderr, "%.6f %-15s %s\n", network_time, "| HookCallFunction",
|
||||||
d.Description());
|
d.Description());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +80,16 @@ bool Plugin::HookQueueEvent(Event* event)
|
||||||
HookArgument(event).Describe(&d);
|
HookArgument(event).Describe(&d);
|
||||||
fprintf(stderr, "%.6f %-15s %s\n", network_time, "| HookQueueEvent",
|
fprintf(stderr, "%.6f %-15s %s\n", network_time, "| HookQueueEvent",
|
||||||
d.Description());
|
d.Description());
|
||||||
|
|
||||||
|
static int i = 0;
|
||||||
|
|
||||||
|
if ( network_time && i == 0 ) {
|
||||||
|
fprintf(stderr, "%.6f %-15s %s\n", network_time, "| RequestObjDtor",
|
||||||
|
d.Description());
|
||||||
|
RequestBroObjDtor(event);
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +104,11 @@ void Plugin::HookUpdateNetworkTime(double network_time)
|
||||||
network_time);
|
network_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plugin::HookBroObjDtor(void* obj)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%.6f %-15s\n", ::network_time, "| HookBroObjDtor");
|
||||||
|
}
|
||||||
|
|
||||||
void Plugin::MetaHookPre(HookType hook, const HookArgumentList& args)
|
void Plugin::MetaHookPre(HookType hook, const HookArgumentList& args)
|
||||||
{
|
{
|
||||||
ODesc d;
|
ODesc d;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# @TEST-EXEC: ${DIST}/aux/bro-aux/plugin-support/init-plugin Demo Hooks
|
# @TEST-EXEC: ${DIST}/aux/bro-aux/plugin-support/init-plugin Demo Hooks
|
||||||
# @TEST-EXEC: cp -r %DIR/hooks-plugin/* .
|
# @TEST-EXEC: cp -r %DIR/hooks-plugin/* .
|
||||||
# @TEST-EXEC: make BRO=${DIST}
|
# @TEST-EXEC: make BRO=${DIST}
|
||||||
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd` bro -r $TRACES/http/get.trace %INPUT 2>&1 | sort >output
|
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd` bro -r $TRACES/http/get.trace %INPUT 2>&1 | $SCRIPTS/diff-remove-abspath | sort | uniq >output
|
||||||
# @TEST-EXEC: btest-diff output
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue