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

@ -51,7 +51,7 @@ void PcapDumper::Open()
if ( exists < 0 && errno != ENOENT )
{
Error(fmt("can't stat file %s: %s", props.path.c_str(), strerror(errno)));
Error(zeek::util::fmt("can't stat file %s: %s", props.path.c_str(), strerror(errno)));
return;
}
}
@ -76,7 +76,7 @@ void PcapDumper::Open()
dumper = (pcap_dumper_t*) fopen(props.path.c_str(), "a");
if ( ! dumper )
{
Error(fmt("can't open dump %s: %s", props.path.c_str(), strerror(errno)));
Error(zeek::util::fmt("can't open dump %s: %s", props.path.c_str(), strerror(errno)));
return;
}
}

View file

@ -61,7 +61,7 @@ void PcapSource::OpenLive()
if ( pcap_findalldevs(&devs, errbuf) < 0 )
{
Error(fmt("pcap_findalldevs: %s", errbuf));
Error(zeek::util::fmt("pcap_findalldevs: %s", errbuf));
return;
}
@ -157,7 +157,7 @@ void PcapSource::OpenLive()
#endif
#ifdef HAVE_PCAP_INT_H
Info(fmt("pcap bufsize = %d\n", ((struct pcap *) pd)->bufsize));
Info(zeek::util::fmt("pcap bufsize = %d\n", ((struct pcap *) pd)->bufsize));
#endif
props.selectable_fd = pcap_get_selectable_fd(pd);
@ -328,12 +328,12 @@ void PcapSource::PcapError(const char* where)
std::string location;
if ( where )
location = fmt(" (%s)", where);
location = zeek::util::fmt(" (%s)", where);
if ( pd )
Error(fmt("pcap_error: %s%s", pcap_geterr(pd), location.c_str()));
Error(zeek::util::fmt("pcap_error: %s%s", pcap_geterr(pd), location.c_str()));
else
Error(fmt("pcap_error: not open%s", location.c_str()));
Error(zeek::util::fmt("pcap_error: not open%s", location.c_str()));
Close();
}

View file

@ -33,7 +33,8 @@ function precompile_pcap_filter%(id: PcapFilterID, s: string%): bool
// We use a vector as underlying data structure for fast
// lookups and limit the ID space so that that doesn't grow too
// large.
zeek::emit_builtin_error(fmt("PCAP filter ids must remain below 100 (is %" PRId64 ")", id->AsInt()));
zeek::emit_builtin_error(
zeek::util::fmt("PCAP filter ids must remain below 100 (is %" PRId64 ")", id->AsInt()));
return zeek::val_mgr->False();
}