signatures: Support custom event via [event_name] syntax

This change allows to specify a per signature specific event, overriding
the default signature_match event. It further removes the message
parameter from such events if not provided in the signature.

This also tracks the message as StringValPtr directly to avoid
allocating the same StringVal for every DoAction() call.

Closes #3403
This commit is contained in:
Arne Welzel 2023-11-29 17:27:29 +01:00
parent d11ac929af
commit a7b077aa17
10 changed files with 202 additions and 10 deletions

View file

@ -191,6 +191,12 @@ rule_attr:
(zeek::detail::RuleHdrTest::Comp) $2, $3));
}
| TOK_EVENT '[' TOK_IDENT ']'
{ current_rule->AddAction(new zeek::detail::RuleActionEvent(nullptr, $3)); }
| TOK_EVENT '[' TOK_IDENT ']' string
{ current_rule->AddAction(new zeek::detail::RuleActionEvent($5, $3)); }
| TOK_EVENT string
{ current_rule->AddAction(new zeek::detail::RuleActionEvent($2)); }