mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00

Includes: - Cleanup of the plugin API, in particular generally changing const char* to std::string - Renaming environment variable BRO_PLUGINS to BRO_PLUGIN_PATH, defaulting to <prefix>/lib/bro/plugins - Reworking how dynamic plugins are searched and activated. See doc/devel/plugins.rst for details. - New @load-plugin directive to explicitly activate a plugin - Support for Darwin. (Linux untested right now) - The init-plugin updates come with support for "make test", "make sdist", and "make bdist" (see how-to). - Test updates. Notes: The new hook mechanism, which allows plugins to hook into Bro's core a well-defined points, is still essentially untested.
45 lines
1.2 KiB
Bash
45 lines
1.2 KiB
Bash
# @TEST-EXEC: ${DIST}/aux/bro-aux/plugin-support/init-plugin Demo Foo
|
|
# @TEST-EXEC: bash %INPUT
|
|
# @TEST-EXEC: make BRO=${DIST}
|
|
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd` bro -NN | awk '/^Plugin:.*Demo/ {p=1; print; next} /^Plugin:/{p=0} p==1{print}' >>output
|
|
# @TEST-EXEC: echo === >>output
|
|
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd` bro -r $TRACES/empty.trace >>output
|
|
# @TEST-EXEC: echo === >>output
|
|
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd` bro demo/foo -r $TRACES/empty.trace >>output
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
cat >scripts/__load__.bro <<EOF
|
|
@load ./demo/foo/base/at-startup.bro
|
|
EOF
|
|
|
|
cat >scripts/demo/foo/__load__.bro <<EOF
|
|
@load ./manually.bro
|
|
EOF
|
|
|
|
cat >scripts/demo/foo/manually.bro <<EOF
|
|
event bro_init()
|
|
{
|
|
print "plugin: manually loaded";
|
|
}
|
|
EOF
|
|
|
|
mkdir -p scripts/demo/foo/base/
|
|
|
|
cat >scripts/demo/foo/base/at-startup.bro <<EOF
|
|
event bro_init()
|
|
{
|
|
print "plugin: automatically loaded at startup";
|
|
print "calling bif", hello_plugin_world();
|
|
}
|
|
EOF
|
|
|
|
cat >src/functions.bif <<EOF
|
|
function hello_plugin_world%(%): string
|
|
%{
|
|
return new StringVal("Hello from the plugin!");
|
|
%}
|
|
EOF
|
|
|
|
cat >src/events.bif <<EOF
|
|
event plugin_event%(foo: count%);
|
|
EOF
|