Move everything in util.h to zeek::util namespace.

This commit includes renaming a number of methods prefixed with bro_ to be prefixed with zeek_.
This commit is contained in:
Tim Wojtulewicz 2020-08-06 10:40:24 -07:00
parent 8862b585fa
commit 8d2d867a65
179 changed files with 1277 additions and 1033 deletions

View file

@ -83,7 +83,7 @@ double PktSrc::CurrentPacketWallClock()
{
// We stop time when we are suspended.
if ( zeek::net::net_is_processing_suspended() )
current_wallclock = current_time(true);
current_wallclock = zeek::util::current_time(true);
return current_wallclock;
}
@ -112,7 +112,7 @@ void PktSrc::Opened(const Properties& arg_props)
if ( props.is_live )
{
Info(fmt("listening on %s\n", props.path.c_str()));
Info(zeek::util::fmt("listening on %s\n", props.path.c_str()));
// We only register the file descriptor if we're in live
// mode because libpcap's file descriptor for trace files
@ -163,7 +163,7 @@ void PktSrc::InternalError(const std::string& msg)
void PktSrc::ContinueAfterSuspend()
{
current_wallclock = current_time(true);
current_wallclock = zeek::util::current_time(true);
}
double PktSrc::CheckPseudoTime()
@ -175,7 +175,7 @@ double PktSrc::CheckPseudoTime()
return 0;
double pseudo_time = current_packet.time - first_timestamp;
double ct = (current_time(true) - first_wallclock) * zeek::net::pseudo_realtime;
double ct = (zeek::util::current_time(true) - first_wallclock) * zeek::net::pseudo_realtime;
return pseudo_time <= ct ? zeek::net::zeek_start_time + pseudo_time : 0;
}
@ -206,7 +206,7 @@ void PktSrc::Process()
current_pseudo = CheckPseudoTime();
zeek::net::detail::net_packet_dispatch(current_pseudo, &current_packet, this);
if ( ! first_wallclock )
first_wallclock = current_time(true);
first_wallclock = zeek::util::current_time(true);
}
else
@ -235,7 +235,7 @@ bool PktSrc::ExtractNextPacketInternal()
return false;
if ( zeek::net::pseudo_realtime )
current_wallclock = current_time(true);
current_wallclock = zeek::util::current_time(true);
if ( ExtractNextPacket(&current_packet) )
{
@ -273,7 +273,7 @@ bool PktSrc::PrecompileBPFFilter(int index, const std::string& filter)
if ( ! code->Compile(zeek::BifConst::Pcap::snaplen, LinkType(), filter.c_str(), Netmask(), errbuf, sizeof(errbuf)) )
{
std::string msg = fmt("cannot compile BPF filter \"%s\"", filter.c_str());
std::string msg = zeek::util::fmt("cannot compile BPF filter \"%s\"", filter.c_str());
if ( *errbuf )
msg += ": " + std::string(errbuf);
@ -310,7 +310,7 @@ bool PktSrc::ApplyBPFFilter(int index, const struct pcap_pkthdr *hdr, const u_ch
if ( ! code )
{
Error(fmt("BPF filter %d not compiled", index));
Error(zeek::util::fmt("BPF filter %d not compiled", index));
Close();
return false;
}
@ -353,7 +353,7 @@ double PktSrc::GetNextTimeout()
ExtractNextPacketInternal();
double pseudo_time = current_packet.time - first_timestamp;
double ct = (current_time(true) - first_wallclock) * zeek::net::pseudo_realtime;
double ct = (zeek::util::current_time(true) - first_wallclock) * zeek::net::pseudo_realtime;
return std::max(0.0, pseudo_time - ct);
}