mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Add new function flavor called a "hook".
This new flavor of function behaves like a "synchronous event". See documentation for more details on usage.
This commit is contained in:
parent
5508a5bb80
commit
e0fb9eb2b2
30 changed files with 476 additions and 79 deletions
|
@ -389,23 +389,30 @@ bool Serializer::UnserializeCall(UnserialInfo* info)
|
|||
{
|
||||
if ( info->print )
|
||||
fprintf(info->print, "%s [%.06f] %s(%s)\n",
|
||||
functype->IsEvent() ? "Event" : "Function call",
|
||||
functype->FlavorString().c_str(),
|
||||
time, name, types ? d.Description() : "<ignored>");
|
||||
|
||||
if ( functype->IsEvent() )
|
||||
switch ( functype->Flavor() ) {
|
||||
case FUNC_FLAVOR_EVENT:
|
||||
{
|
||||
EventHandler* handler = event_registry->Lookup(name);
|
||||
assert(handler);
|
||||
if ( ! info->ignore_callbacks )
|
||||
GotEvent(name, time, handler, args);
|
||||
}
|
||||
else
|
||||
break;
|
||||
case FUNC_FLAVOR_FUNCTION:
|
||||
case FUNC_FLAVOR_HOOK:
|
||||
if ( ! info->ignore_callbacks )
|
||||
GotFunctionCall(name, time, id->ID_Val()->AsFunc(), args);
|
||||
break;
|
||||
default:
|
||||
reporter->InternalError("invalid function flavor");
|
||||
break;
|
||||
}
|
||||
|
||||
if ( info->ignore_callbacks )
|
||||
delete_vals(args);
|
||||
|
||||
}
|
||||
else
|
||||
delete_vals(args);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue