mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

This reflects the `spicy-plugin` code as of `d8c296b81cc2a11`. In addition to moving the code into Zeek's source tree, this comes with a couple small functional changes: - `spicyz` no longer tries to infer if it's running from the build directory. Instead `ZEEK_SPICY_LIBRARY` can be set to a custom location. `zeek-set-path.sh` does that now. - ZEEK_CONFIG can be set to change what `spicyz -z` print out. This is primarily for backwards compatibility. Some further notes on specifics: - We raise the minimum Spicy version to 1.8 (i.e., current `main` branch). - Renamed the `compiler/` subdirectory to `spicyz` to avoid include-path conflicts with the Spicy headers. - In `cmake/`, the corresponding PR brings a new/extended version of `FindZeek`, which Spicy analyzer packages need. We also now install some of the files that the Spicy plugin used to bring for testing, so that existing packages keep working. - For now, this all remains backwards compatible with the current `zkg` analyzer templates so that they work with both external and integrated Spicy support. Later, once we don't need to support any external Spicy plugin versions anymore, we can clean up the templates as well. - All the plugin's tests have moved into the standard test suite. They are skipped if configure with `--disable-spicy`. This holds off on adapting the new code further to Zeek's coding conventions, so that it remains easier to maintain it in parallel to the (now legacy) external plugin. We'll make a pass over the formatting for (presumable) Zeek 6.1.
81 lines
2.4 KiB
Text
81 lines
2.4 KiB
Text
@load base/misc/version
|
|
|
|
# doc-common-start
|
|
module Spicy;
|
|
|
|
export {
|
|
# doc-functions-start
|
|
## Enable a specific Spicy protocol analyzer if not already active. If this
|
|
## analyzer replaces an standard analyzer, that one will automatically be
|
|
## disabled.
|
|
##
|
|
## tag: analyzer to toggle
|
|
##
|
|
## Returns: true if the operation succeeded
|
|
global enable_protocol_analyzer: function(tag: Analyzer::Tag) : bool;
|
|
|
|
## Disable a specific Spicy protocol analyzer if not already inactive. If
|
|
## this analyzer replaces an standard analyzer, that one will automatically
|
|
## be re-enabled.
|
|
##
|
|
## tag: analyzer to toggle
|
|
##
|
|
## Returns: true if the operation succeeded
|
|
global disable_protocol_analyzer: function(tag: Analyzer::Tag) : bool;
|
|
|
|
|
|
## Enable a specific Spicy file analyzer if not already active. If this
|
|
## analyzer replaces an standard analyzer, that one will automatically be
|
|
## disabled.
|
|
##
|
|
## tag: analyzer to toggle
|
|
##
|
|
## Returns: true if the operation succeeded
|
|
global enable_file_analyzer: function(tag: Files::Tag) : bool;
|
|
|
|
## Disable a specific Spicy file analyzer if not already inactive. If
|
|
## this analyzer replaces an standard analyzer, that one will automatically
|
|
## be re-enabled.
|
|
##
|
|
## tag: analyzer to toggle
|
|
##
|
|
## Returns: true if the operation succeeded
|
|
global disable_file_analyzer: function(tag: Files::Tag) : bool;
|
|
|
|
## Returns current resource usage as reported by the Spicy runtime system.
|
|
global resource_usage: function() : ResourceUsage;
|
|
# doc-functions-end
|
|
}
|
|
|
|
# Marked with &is_used to suppress complaints when there aren't any
|
|
# Spicy file analyzers loaded, and hence this event can't be generated.
|
|
# The attribute is only supported for Zeek 5.0 and higher.
|
|
event spicy_analyzer_for_mime_type(a: Files::Tag, mt: string) &is_used
|
|
{
|
|
Files::register_for_mime_type(a, mt);
|
|
}
|
|
|
|
function enable_protocol_analyzer(tag: Analyzer::Tag) : bool
|
|
{
|
|
return Spicy::__toggle_analyzer(tag, T);
|
|
}
|
|
|
|
function disable_protocol_analyzer(tag: Analyzer::Tag) : bool
|
|
{
|
|
return Spicy::__toggle_analyzer(tag, F);
|
|
}
|
|
|
|
function enable_file_analyzer(tag: Files::Tag) : bool
|
|
{
|
|
return Spicy::__toggle_analyzer(tag, T);
|
|
}
|
|
|
|
function disable_file_analyzer(tag: Files::Tag) : bool
|
|
{
|
|
return Spicy::__toggle_analyzer(tag, F);
|
|
}
|
|
|
|
function resource_usage() : ResourceUsage
|
|
{
|
|
return Spicy::__resource_usage();
|
|
}
|