mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Move the functions and variables in Net.h to the zeek::net namespace. This includes moving network_time out of util.h.
This commit is contained in:
parent
ca9baec6e8
commit
e7c6d51ae7
55 changed files with 461 additions and 374 deletions
|
@ -82,7 +82,7 @@ double PktSrc::CurrentPacketTimestamp()
|
|||
double PktSrc::CurrentPacketWallClock()
|
||||
{
|
||||
// We stop time when we are suspended.
|
||||
if ( net_is_processing_suspended() )
|
||||
if ( zeek::net::net_is_processing_suspended() )
|
||||
current_wallclock = current_time(true);
|
||||
|
||||
return current_wallclock;
|
||||
|
@ -175,9 +175,9 @@ double PktSrc::CheckPseudoTime()
|
|||
return 0;
|
||||
|
||||
double pseudo_time = current_packet.time - first_timestamp;
|
||||
double ct = (current_time(true) - first_wallclock) * pseudo_realtime;
|
||||
double ct = (current_time(true) - first_wallclock) * zeek::net::pseudo_realtime;
|
||||
|
||||
return pseudo_time <= ct ? bro_start_time + pseudo_time : 0;
|
||||
return pseudo_time <= ct ? zeek::net::zeek_start_time + pseudo_time : 0;
|
||||
}
|
||||
|
||||
void PktSrc::InitSource()
|
||||
|
@ -201,16 +201,16 @@ void PktSrc::Process()
|
|||
|
||||
if ( current_packet.Layer2Valid() )
|
||||
{
|
||||
if ( pseudo_realtime )
|
||||
if ( zeek::net::pseudo_realtime )
|
||||
{
|
||||
current_pseudo = CheckPseudoTime();
|
||||
net_packet_dispatch(current_pseudo, ¤t_packet, this);
|
||||
zeek::net::detail::net_packet_dispatch(current_pseudo, ¤t_packet, this);
|
||||
if ( ! first_wallclock )
|
||||
first_wallclock = current_time(true);
|
||||
}
|
||||
|
||||
else
|
||||
net_packet_dispatch(current_packet.time, ¤t_packet, this);
|
||||
zeek::net::detail::net_packet_dispatch(current_packet.time, ¤t_packet, this);
|
||||
}
|
||||
|
||||
have_packet = false;
|
||||
|
@ -231,10 +231,10 @@ bool PktSrc::ExtractNextPacketInternal()
|
|||
|
||||
// Don't return any packets if processing is suspended (except for the
|
||||
// very first packet which we need to set up times).
|
||||
if ( net_is_processing_suspended() && first_timestamp )
|
||||
if ( zeek::net::net_is_processing_suspended() && first_timestamp )
|
||||
return false;
|
||||
|
||||
if ( pseudo_realtime )
|
||||
if ( zeek::net::pseudo_realtime )
|
||||
current_wallclock = current_time(true);
|
||||
|
||||
if ( ExtractNextPacket(¤t_packet) )
|
||||
|
@ -252,7 +252,7 @@ bool PktSrc::ExtractNextPacketInternal()
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( pseudo_realtime && ! IsOpen() )
|
||||
if ( zeek::net::pseudo_realtime && ! IsOpen() )
|
||||
{
|
||||
if ( broker_mgr->Active() )
|
||||
iosource_mgr->Terminate();
|
||||
|
@ -344,16 +344,16 @@ double PktSrc::GetNextTimeout()
|
|||
// but we're not in pseudo-realtime mode, let the loop just spin as fast as it can. If we're
|
||||
// in pseudo-realtime mode, find the next time that a packet is ready and have poll block until
|
||||
// then.
|
||||
if ( IsLive() || net_is_processing_suspended() )
|
||||
if ( IsLive() || zeek::net::net_is_processing_suspended() )
|
||||
return -1;
|
||||
else if ( ! pseudo_realtime )
|
||||
else if ( ! zeek::net::pseudo_realtime )
|
||||
return 0;
|
||||
|
||||
if ( ! have_packet )
|
||||
ExtractNextPacketInternal();
|
||||
|
||||
double pseudo_time = current_packet.time - first_timestamp;
|
||||
double ct = (current_time(true) - first_wallclock) * pseudo_realtime;
|
||||
double ct = (current_time(true) - first_wallclock) * zeek::net::pseudo_realtime;
|
||||
return std::max(0.0, pseudo_time - ct);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue