mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Change packet source fields of Options to std::optional
This commit is contained in:
parent
b0a5eb27b1
commit
2f36113743
5 changed files with 22 additions and 20 deletions
16
src/Net.cc
16
src/Net.cc
|
@ -145,34 +145,34 @@ void net_update_time(double new_network_time)
|
|||
PLUGIN_HOOK_VOID(HOOK_UPDATE_NETWORK_TIME, HookUpdateNetworkTime(new_network_time));
|
||||
}
|
||||
|
||||
void net_init(const std::string& interface,
|
||||
const std::string& pcap_input_file,
|
||||
void net_init(const std::optional<std::string>& interface,
|
||||
const std::optional<std::string>& pcap_input_file,
|
||||
const std::optional<std::string>& pcap_output_file,
|
||||
bool do_watchdog)
|
||||
{
|
||||
if ( ! pcap_input_file.empty() )
|
||||
if ( pcap_input_file )
|
||||
{
|
||||
reading_live = pseudo_realtime > 0.0;
|
||||
reading_traces = true;
|
||||
|
||||
iosource::PktSrc* ps = iosource_mgr->OpenPktSrc(pcap_input_file, false);
|
||||
iosource::PktSrc* ps = iosource_mgr->OpenPktSrc(*pcap_input_file, false);
|
||||
assert(ps);
|
||||
|
||||
if ( ! ps->IsOpen() )
|
||||
reporter->FatalError("problem with trace file %s (%s)",
|
||||
pcap_input_file.c_str(), ps->ErrorMsg());
|
||||
pcap_input_file->c_str(), ps->ErrorMsg());
|
||||
}
|
||||
else if ( ! interface.empty() )
|
||||
else if ( interface )
|
||||
{
|
||||
reading_live = true;
|
||||
reading_traces = false;
|
||||
|
||||
iosource::PktSrc* ps = iosource_mgr->OpenPktSrc(interface, true);
|
||||
iosource::PktSrc* ps = iosource_mgr->OpenPktSrc(*interface, true);
|
||||
assert(ps);
|
||||
|
||||
if ( ! ps->IsOpen() )
|
||||
reporter->FatalError("problem with interface %s (%s)",
|
||||
interface.c_str(), ps->ErrorMsg());
|
||||
interface->c_str(), ps->ErrorMsg());
|
||||
}
|
||||
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue