mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00

This is based on commit 2731def9159247e6da8a3191783c89683363689c from the zeek-docs repo.
26 lines
627 B
Text
26 lines
627 B
Text
redef exit_only_after_terminate = T;
|
|
global my_event: event(msg: string, c: count);
|
|
|
|
event zeek_init()
|
|
{
|
|
Broker::peer("127.0.0.1");
|
|
}
|
|
|
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
|
{
|
|
print "peer added", endpoint;
|
|
Broker::publish("zeek/event/my_event", my_event, "hi", 0);
|
|
Broker::publish("zeek/event/my_event", my_event, "...", 1);
|
|
local e = Broker::make_event(my_event, "bye", 2);
|
|
Broker::publish("zeek/event/my_event", e);
|
|
}
|
|
|
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
|
{
|
|
terminate();
|
|
}
|
|
|
|
event my_event(msg: string, c: count)
|
|
{
|
|
print "got my_event", msg, c;
|
|
}
|