Add network_time_init() event.

This commit is contained in:
Jan Grashoefer 2020-04-29 13:19:57 +02:00
parent c99f825e22
commit 97d1acf86f
2 changed files with 13 additions and 1 deletions

View file

@ -223,7 +223,11 @@ void expire_timers(iosource::PktSrc* src_ps)
void net_packet_dispatch(double t, const Packet* pkt, iosource::PktSrc* src_ps) void net_packet_dispatch(double t, const Packet* pkt, iosource::PktSrc* src_ps)
{ {
if ( ! bro_start_network_time ) if ( ! bro_start_network_time )
{
bro_start_network_time = t; bro_start_network_time = t;
if ( network_time_init )
mgr.Enqueue(network_time_init, zeek::Args{});
}
// network_time never goes back. // network_time never goes back.
net_update_time(timer_mgr->Time() < t ? t : timer_mgr->Time()); net_update_time(timer_mgr->Time() < t ? t : timer_mgr->Time());

View file

@ -35,7 +35,7 @@
## one-time initialization code at startup. At the time a handler runs, Zeek will ## one-time initialization code at startup. At the time a handler runs, Zeek will
## have executed any global initializations and statements. ## have executed any global initializations and statements.
## ##
## .. zeek:see:: zeek_done ## .. zeek:see:: zeek_done, network_time_init
## ##
## .. note:: ## .. note::
## ##
@ -61,6 +61,14 @@ event zeek_init%(%);
## is not generated. ## is not generated.
event zeek_done%(%); event zeek_done%(%);
## Generated when network time is initialized. The event engine generates this
## event after the network time has been determined but before processing of
## packets is started.
##
## .. zeek:see:: zeek_init, network_time
##
event network_time_init%(%);
## Generated for every new connection. This event is raised with the first ## Generated for every new connection. This event is raised with the first
## packet of a previously unknown connection. Zeek uses a flow-based definition ## packet of a previously unknown connection. Zeek uses a flow-based definition
## of "connection" here that includes not only TCP sessions but also UDP and ## of "connection" here that includes not only TCP sessions but also UDP and