mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
Rename methods in RunState to remove 'net' from their names
This commit is contained in:
parent
0ac3fafe13
commit
54215ab9cd
11 changed files with 63 additions and 64 deletions
|
@ -227,7 +227,7 @@ void EventMgr::Process()
|
||||||
// here to the current time since otherwise it won't move forward.
|
// here to the current time since otherwise it won't move forward.
|
||||||
zeek::iosource::PktSrc* pkt_src = zeek::iosource_mgr->GetPktSrc();
|
zeek::iosource::PktSrc* pkt_src = zeek::iosource_mgr->GetPktSrc();
|
||||||
if ( ! pkt_src || ! pkt_src->IsOpen() || zeek::run_state::reading_live )
|
if ( ! pkt_src || ! pkt_src->IsOpen() || zeek::run_state::reading_live )
|
||||||
zeek::run_state::detail::net_update_time(zeek::util::current_time());
|
zeek::run_state::detail::update_network_time(zeek::util::current_time());
|
||||||
|
|
||||||
queue_flare.Extinguish();
|
queue_flare.Extinguish();
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -110,8 +109,8 @@ RETSIGTYPE watchdog(int /* signo */)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
net_get_final_stats();
|
get_final_stats();
|
||||||
net_finish(0);
|
finish_run(0);
|
||||||
|
|
||||||
zeek::reporter->FatalErrorWithCore(
|
zeek::reporter->FatalErrorWithCore(
|
||||||
"**watchdog timer expired, t = %d.%06d, start = %d.%06d, dispatched = %d",
|
"**watchdog timer expired, t = %d.%06d, start = %d.%06d, dispatched = %d",
|
||||||
|
@ -126,13 +125,13 @@ RETSIGTYPE watchdog(int /* signo */)
|
||||||
return RETSIGVAL;
|
return RETSIGVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_update_time(double new_network_time)
|
void update_network_time(double new_network_time)
|
||||||
{
|
{
|
||||||
network_time = new_network_time;
|
network_time = new_network_time;
|
||||||
PLUGIN_HOOK_VOID(HOOK_UPDATE_NETWORK_TIME, HookUpdateNetworkTime(new_network_time));
|
PLUGIN_HOOK_VOID(HOOK_UPDATE_NETWORK_TIME, HookUpdateNetworkTime(new_network_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_init(const std::optional<std::string>& interface,
|
void init_run(const std::optional<std::string>& interface,
|
||||||
const std::optional<std::string>& pcap_input_file,
|
const std::optional<std::string>& pcap_input_file,
|
||||||
const std::optional<std::string>& pcap_output_file,
|
const std::optional<std::string>& pcap_output_file,
|
||||||
bool do_watchdog)
|
bool do_watchdog)
|
||||||
|
@ -206,7 +205,7 @@ void expire_timers(zeek::iosource::PktSrc* src_ps)
|
||||||
zeek::detail::max_timer_expires - current_dispatched);
|
zeek::detail::max_timer_expires - current_dispatched);
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_packet_dispatch(double t, const zeek::Packet* pkt, zeek::iosource::PktSrc* src_ps)
|
void dispatch_packet(double t, const zeek::Packet* pkt, zeek::iosource::PktSrc* src_ps)
|
||||||
{
|
{
|
||||||
if ( ! zeek_start_network_time )
|
if ( ! zeek_start_network_time )
|
||||||
{
|
{
|
||||||
|
@ -217,7 +216,7 @@ void net_packet_dispatch(double t, const zeek::Packet* pkt, zeek::iosource::PktS
|
||||||
}
|
}
|
||||||
|
|
||||||
// network_time never goes back.
|
// network_time never goes back.
|
||||||
net_update_time(zeek::detail::timer_mgr->Time() < t ? t : zeek::detail::timer_mgr->Time());
|
update_network_time(zeek::detail::timer_mgr->Time() < t ? t : zeek::detail::timer_mgr->Time());
|
||||||
|
|
||||||
current_pktsrc = src_ps;
|
current_pktsrc = src_ps;
|
||||||
current_iosrc = src_ps;
|
current_iosrc = src_ps;
|
||||||
|
@ -261,9 +260,9 @@ void net_packet_dispatch(double t, const zeek::Packet* pkt, zeek::iosource::PktS
|
||||||
current_pktsrc = nullptr;
|
current_pktsrc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_run()
|
void run_loop()
|
||||||
{
|
{
|
||||||
zeek::util::detail::set_processing_status("RUNNING", "net_run");
|
zeek::util::detail::set_processing_status("RUNNING", "run_loop");
|
||||||
|
|
||||||
std::vector<zeek::iosource::IOSource*> ready;
|
std::vector<zeek::iosource::IOSource*> ready;
|
||||||
ready.reserve(zeek::iosource_mgr->TotalSize());
|
ready.reserve(zeek::iosource_mgr->TotalSize());
|
||||||
|
@ -307,7 +306,7 @@ void net_run()
|
||||||
// date on timers and events. Because we only
|
// date on timers and events. Because we only
|
||||||
// have timers as sources, going to sleep here
|
// have timers as sources, going to sleep here
|
||||||
// doesn't risk blocking on other inputs.
|
// doesn't risk blocking on other inputs.
|
||||||
net_update_time(zeek::util::current_time());
|
update_network_time(zeek::util::current_time());
|
||||||
expire_timers();
|
expire_timers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,14 +341,14 @@ void net_run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the final statistics now, and not when net_finish() is
|
// Get the final statistics now, and not when finish_run() is
|
||||||
// called, since that might happen quite a bit in the future
|
// called, since that might happen quite a bit in the future
|
||||||
// due to expiring pending timers, and we don't want to ding
|
// due to expiring pending timers, and we don't want to ding
|
||||||
// for any packets dropped beyond this point.
|
// for any packets dropped beyond this point.
|
||||||
net_get_final_stats();
|
get_final_stats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_get_final_stats()
|
void get_final_stats()
|
||||||
{
|
{
|
||||||
zeek::iosource::PktSrc* ps = zeek::iosource_mgr->GetPktSrc();
|
zeek::iosource::PktSrc* ps = zeek::iosource_mgr->GetPktSrc();
|
||||||
if ( ps && ps->IsLive() )
|
if ( ps && ps->IsLive() )
|
||||||
|
@ -362,9 +361,9 @@ void net_get_final_stats()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_finish(int drain_events)
|
void finish_run(int drain_events)
|
||||||
{
|
{
|
||||||
zeek::util::detail::set_processing_status("TERMINATING", "net_finish");
|
zeek::util::detail::set_processing_status("TERMINATING", "finish_run");
|
||||||
|
|
||||||
if ( drain_events )
|
if ( drain_events )
|
||||||
{
|
{
|
||||||
|
@ -387,9 +386,9 @@ void net_finish(int drain_events)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_delete()
|
void delete_run()
|
||||||
{
|
{
|
||||||
zeek::util::detail::set_processing_status("TERMINATING", "net_delete");
|
zeek::util::detail::set_processing_status("TERMINATING", "delete_run");
|
||||||
|
|
||||||
delete zeek::sessions;
|
delete zeek::sessions;
|
||||||
|
|
||||||
|
@ -416,7 +415,7 @@ double current_timestamp = 0.0;
|
||||||
|
|
||||||
static int _processing_suspended = 0;
|
static int _processing_suspended = 0;
|
||||||
|
|
||||||
void net_suspend_processing()
|
void suspend_processing()
|
||||||
{
|
{
|
||||||
if ( _processing_suspended == 0 )
|
if ( _processing_suspended == 0 )
|
||||||
zeek::reporter->Info("processing suspended");
|
zeek::reporter->Info("processing suspended");
|
||||||
|
@ -424,7 +423,7 @@ void net_suspend_processing()
|
||||||
++_processing_suspended;
|
++_processing_suspended;
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_continue_processing()
|
void continue_processing()
|
||||||
{
|
{
|
||||||
if ( _processing_suspended == 1 )
|
if ( _processing_suspended == 1 )
|
||||||
{
|
{
|
||||||
|
@ -436,7 +435,7 @@ void net_continue_processing()
|
||||||
--_processing_suspended;
|
--_processing_suspended;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool net_is_processing_suspended() { return _processing_suspended; }
|
bool is_processing_suspended() { return _processing_suspended; }
|
||||||
|
|
||||||
} // namespace zeek::run_state
|
} // namespace zeek::run_state
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,16 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(Packet, zeek);
|
||||||
namespace zeek::run_state {
|
namespace zeek::run_state {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
extern void net_init(const std::optional<std::string>& interfaces,
|
extern void init_run(const std::optional<std::string>& interfaces,
|
||||||
const std::optional<std::string>& pcap_input_file,
|
const std::optional<std::string>& pcap_input_file,
|
||||||
const std::optional<std::string>& pcap_output_file,
|
const std::optional<std::string>& pcap_output_file,
|
||||||
bool do_watchdog);
|
bool do_watchdog);
|
||||||
extern void net_run();
|
extern void run_loop();
|
||||||
extern void net_get_final_stats();
|
extern void get_final_stats();
|
||||||
extern void net_finish(int drain_events);
|
extern void finish_run(int drain_events);
|
||||||
extern void net_delete(); // Reclaim all memory, etc.
|
extern void delete_run(); // Reclaim all memory, etc.
|
||||||
extern void net_update_time(double new_network_time);
|
extern void update_network_time(double new_network_time);
|
||||||
extern void net_packet_dispatch(double t, const zeek::Packet* pkt,
|
extern void dispatch_packet(double t, const zeek::Packet* pkt,
|
||||||
zeek::iosource::PktSrc* src_ps);
|
zeek::iosource::PktSrc* src_ps);
|
||||||
extern void expire_timers(zeek::iosource::PktSrc* src_ps = nullptr);
|
extern void expire_timers(zeek::iosource::PktSrc* src_ps = nullptr);
|
||||||
extern void zeek_terminate_loop(const char* reason);
|
extern void zeek_terminate_loop(const char* reason);
|
||||||
|
@ -44,9 +44,9 @@ extern bool have_pending_timers;
|
||||||
|
|
||||||
// Functions to temporarily suspend processing of live input (network packets
|
// Functions to temporarily suspend processing of live input (network packets
|
||||||
// and remote events/state). Turning this is on is sure to lead to data loss!
|
// and remote events/state). Turning this is on is sure to lead to data loss!
|
||||||
extern void net_suspend_processing();
|
extern void suspend_processing();
|
||||||
extern void net_continue_processing();
|
extern void continue_processing();
|
||||||
bool net_is_processing_suspended();
|
bool is_processing_suspended();
|
||||||
|
|
||||||
// Whether we're reading live traffic.
|
// Whether we're reading live traffic.
|
||||||
extern bool reading_live;
|
extern bool reading_live;
|
||||||
|
@ -87,13 +87,13 @@ extern double current_timestamp;
|
||||||
|
|
||||||
} // namespace zeek::run_state
|
} // namespace zeek::run_state
|
||||||
|
|
||||||
constexpr auto net_init [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_init.")]] = zeek::run_state::detail::net_init;
|
constexpr auto net_init [[deprecated("Remove in v4.1. Use zeek::run_state::detail::init_run.")]] = zeek::run_state::detail::init_run;
|
||||||
constexpr auto net_run [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_run.")]] = zeek::run_state::detail::net_run;
|
constexpr auto net_run [[deprecated("Remove in v4.1. Use zeek::run_state::detail::run_run.")]] = zeek::run_state::detail::run_loop;
|
||||||
constexpr auto net_get_final_stats [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_get_final_stats.")]] = zeek::run_state::detail::net_get_final_stats;
|
constexpr auto net_get_final_stats [[deprecated("Remove in v4.1. Use zeek::run_state::detail::get_final_stats.")]] = zeek::run_state::detail::get_final_stats;
|
||||||
constexpr auto net_finish [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_finish.")]] = zeek::run_state::detail::net_finish;
|
constexpr auto net_finish [[deprecated("Remove in v4.1. Use zeek::run_state::detail::finish_run.")]] = zeek::run_state::detail::finish_run;
|
||||||
constexpr auto net_delete [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_delete.")]] = zeek::run_state::detail::net_delete;
|
constexpr auto net_delete [[deprecated("Remove in v4.1. Use zeek::run_state::detail::delete_run.")]] = zeek::run_state::detail::delete_run;
|
||||||
constexpr auto net_update_time [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_update_time.")]] = zeek::run_state::detail::net_update_time;
|
constexpr auto net_update_time [[deprecated("Remove in v4.1. Use zeek::run_state::detail::update_network_time.")]] = zeek::run_state::detail::update_network_time;
|
||||||
constexpr auto net_packet_dispatch [[deprecated("Remove in v4.1. Use zeek::run_state::detail::net_packet_dispatch.")]] = zeek::run_state::detail::net_packet_dispatch;
|
constexpr auto net_packet_dispatch [[deprecated("Remove in v4.1. Use zeek::run_state::detail::dispatch_packet.")]] = zeek::run_state::detail::dispatch_packet;
|
||||||
constexpr auto expire_timers [[deprecated("Remove in v4.1. Use zeek::run_state::detail::expire_timers.")]] = zeek::run_state::detail::expire_timers;
|
constexpr auto expire_timers [[deprecated("Remove in v4.1. Use zeek::run_state::detail::expire_timers.")]] = zeek::run_state::detail::expire_timers;
|
||||||
constexpr auto zeek_terminate_loop [[deprecated("Remove in v4.1. Use zeek::run_state::detail::zeek_terminate_loop.")]] = zeek::run_state::detail::zeek_terminate_loop;
|
constexpr auto zeek_terminate_loop [[deprecated("Remove in v4.1. Use zeek::run_state::detail::zeek_terminate_loop.")]] = zeek::run_state::detail::zeek_terminate_loop;
|
||||||
extern zeek::iosource::PktSrc*& current_pktsrc [[deprecated("Remove in v4.1. Use zeek::run_state::detail::current_pktsrc.")]];
|
extern zeek::iosource::PktSrc*& current_pktsrc [[deprecated("Remove in v4.1. Use zeek::run_state::detail::current_pktsrc.")]];
|
||||||
|
@ -101,9 +101,9 @@ extern zeek::iosource::IOSource*& current_iosrc [[deprecated("Remove in v4.1. Us
|
||||||
extern zeek::iosource::PktDumper*& pkt_dumper [[deprecated("Remove in v4.1. Use zeek::run_state::detail::pkt_dumper.")]];
|
extern zeek::iosource::PktDumper*& pkt_dumper [[deprecated("Remove in v4.1. Use zeek::run_state::detail::pkt_dumper.")]];
|
||||||
extern bool& have_pending_timers [[deprecated("Remove in v4.1. Use zeek::run_state::detail::have_pending_timers.")]];
|
extern bool& have_pending_timers [[deprecated("Remove in v4.1. Use zeek::run_state::detail::have_pending_timers.")]];
|
||||||
|
|
||||||
constexpr auto net_suspend_processing [[deprecated("Remove in v4.1. Use zeek::run_state::net_suspend_processing.")]] = zeek::run_state::net_suspend_processing;
|
constexpr auto net_suspend_processing [[deprecated("Remove in v4.1. Use zeek::run_state::suspend_processing.")]] = zeek::run_state::suspend_processing;
|
||||||
constexpr auto net_continue_processing [[deprecated("Remove in v4.1. Use zeek::run_state::net_continue_processing.")]] = zeek::run_state::net_continue_processing;
|
constexpr auto net_continue_processing [[deprecated("Remove in v4.1. Use zeek::run_state::continue_processing.")]] = zeek::run_state::continue_processing;
|
||||||
constexpr auto net_is_processing_suspended [[deprecated("Remove in v4.1. Use zeek::run_state::net_is_processing_suspended.")]] = zeek::run_state::net_is_processing_suspended;
|
constexpr auto net_is_processing_suspended [[deprecated("Remove in v4.1. Use zeek::run_state::is_processing_suspended.")]] = zeek::run_state::is_processing_suspended;
|
||||||
|
|
||||||
extern bool& reading_live [[deprecated("Remove in v4.1. Use zeek::run_state::reading_live.")]];
|
extern bool& reading_live [[deprecated("Remove in v4.1. Use zeek::run_state::reading_live.")]];
|
||||||
extern bool& reading_traces [[deprecated("Remove in v4.1. Use zeek::run_state::reading_traces.")]];
|
extern bool& reading_traces [[deprecated("Remove in v4.1. Use zeek::run_state::reading_traces.")]];
|
||||||
|
|
|
@ -96,13 +96,13 @@ void TimerMgr::Process()
|
||||||
// pseudo-realtime), advance the timer here to the current time since otherwise it won't
|
// pseudo-realtime), advance the timer here to the current time since otherwise it won't
|
||||||
// move forward and the timers won't fire correctly.
|
// move forward and the timers won't fire correctly.
|
||||||
iosource::PktSrc* pkt_src = zeek::iosource_mgr->GetPktSrc();
|
iosource::PktSrc* pkt_src = zeek::iosource_mgr->GetPktSrc();
|
||||||
if ( ! pkt_src || ! pkt_src->IsOpen() || zeek::run_state::reading_live || zeek::run_state::net_is_processing_suspended() )
|
if ( ! pkt_src || ! pkt_src->IsOpen() || zeek::run_state::reading_live || zeek::run_state::is_processing_suspended() )
|
||||||
zeek::run_state::detail::net_update_time(zeek::util::current_time());
|
zeek::run_state::detail::update_network_time(zeek::util::current_time());
|
||||||
|
|
||||||
// Just advance the timer manager based on the current network time. This won't actually
|
// Just advance the timer manager based on the current network time. This won't actually
|
||||||
// change the time, but will dispatch any timers that need dispatching.
|
// change the time, but will dispatch any timers that need dispatching.
|
||||||
zeek::run_state::current_dispatched += Advance(zeek::run_state::network_time,
|
zeek::run_state::current_dispatched += Advance(
|
||||||
max_timer_expires - zeek::run_state::current_dispatched);
|
zeek::run_state::network_time, max_timer_expires - zeek::run_state::current_dispatched);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimerMgr::InitPostScript()
|
void TimerMgr::InitPostScript()
|
||||||
|
|
|
@ -923,7 +923,7 @@ void Manager::Process()
|
||||||
// Ensure that time gets update before processing broker messages, or events
|
// Ensure that time gets update before processing broker messages, or events
|
||||||
// based on them might get scheduled wrong.
|
// based on them might get scheduled wrong.
|
||||||
if ( use_real_time )
|
if ( use_real_time )
|
||||||
zeek::run_state::detail::net_update_time(zeek::util::current_time());
|
zeek::run_state::detail::update_network_time(zeek::util::current_time());
|
||||||
|
|
||||||
bool had_input = false;
|
bool had_input = false;
|
||||||
|
|
||||||
|
@ -999,7 +999,7 @@ void Manager::Process()
|
||||||
// If we're getting Broker messages, but still haven't initialized
|
// If we're getting Broker messages, but still haven't initialized
|
||||||
// zeek::run_state::network_time, may as well do so now because otherwise the
|
// zeek::run_state::network_time, may as well do so now because otherwise the
|
||||||
// broker/cluster logs will end up using timestamp 0.
|
// broker/cluster logs will end up using timestamp 0.
|
||||||
zeek::run_state::detail::net_update_time(zeek::util::current_time());
|
zeek::run_state::detail::update_network_time(zeek::util::current_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ static constexpr auto ZEEK_FUZZ_ANALYZER = "pop3";
|
||||||
static zeek::Connection* add_connection()
|
static zeek::Connection* add_connection()
|
||||||
{
|
{
|
||||||
static constexpr double network_time_start = 1439471031;
|
static constexpr double network_time_start = 1439471031;
|
||||||
net_update_time(network_time_start);
|
zeek::run_state::detail::update_network_time(network_time_start);
|
||||||
|
|
||||||
zeek::Packet p;
|
zeek::Packet p;
|
||||||
zeek::ConnID conn_id;
|
zeek::ConnID conn_id;
|
||||||
|
|
|
@ -82,7 +82,7 @@ double PktSrc::CurrentPacketTimestamp()
|
||||||
double PktSrc::CurrentPacketWallClock()
|
double PktSrc::CurrentPacketWallClock()
|
||||||
{
|
{
|
||||||
// We stop time when we are suspended.
|
// We stop time when we are suspended.
|
||||||
if ( zeek::run_state::net_is_processing_suspended() )
|
if ( zeek::run_state::is_processing_suspended() )
|
||||||
current_wallclock = zeek::util::current_time(true);
|
current_wallclock = zeek::util::current_time(true);
|
||||||
|
|
||||||
return current_wallclock;
|
return current_wallclock;
|
||||||
|
@ -204,13 +204,13 @@ void PktSrc::Process()
|
||||||
if ( zeek::run_state::pseudo_realtime )
|
if ( zeek::run_state::pseudo_realtime )
|
||||||
{
|
{
|
||||||
current_pseudo = CheckPseudoTime();
|
current_pseudo = CheckPseudoTime();
|
||||||
zeek::run_state::detail::net_packet_dispatch(current_pseudo, ¤t_packet, this);
|
zeek::run_state::detail::dispatch_packet(current_pseudo, ¤t_packet, this);
|
||||||
if ( ! first_wallclock )
|
if ( ! first_wallclock )
|
||||||
first_wallclock = zeek::util::current_time(true);
|
first_wallclock = zeek::util::current_time(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
zeek::run_state::detail::net_packet_dispatch(current_packet.time, ¤t_packet, this);
|
zeek::run_state::detail::dispatch_packet(current_packet.time, ¤t_packet, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
have_packet = false;
|
have_packet = false;
|
||||||
|
@ -231,7 +231,7 @@ bool PktSrc::ExtractNextPacketInternal()
|
||||||
|
|
||||||
// Don't return any packets if processing is suspended (except for the
|
// Don't return any packets if processing is suspended (except for the
|
||||||
// very first packet which we need to set up times).
|
// very first packet which we need to set up times).
|
||||||
if ( zeek::run_state::net_is_processing_suspended() && first_timestamp )
|
if ( zeek::run_state::is_processing_suspended() && first_timestamp )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( zeek::run_state::pseudo_realtime )
|
if ( zeek::run_state::pseudo_realtime )
|
||||||
|
@ -344,7 +344,7 @@ double PktSrc::GetNextTimeout()
|
||||||
// but we're not in pseudo-realtime mode, let the loop just spin as fast as it can. If we're
|
// 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
|
// in pseudo-realtime mode, find the next time that a packet is ready and have poll block until
|
||||||
// then.
|
// then.
|
||||||
if ( IsLive() || zeek::run_state::net_is_processing_suspended() )
|
if ( IsLive() || zeek::run_state::is_processing_suspended() )
|
||||||
return -1;
|
return -1;
|
||||||
else if ( ! zeek::run_state::pseudo_realtime )
|
else if ( ! zeek::run_state::pseudo_realtime )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -56,7 +56,7 @@ int main(int argc, char** argv)
|
||||||
mem_net_start_malloced / 1024 / 1024);
|
mem_net_start_malloced / 1024 / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::run_state::detail::net_run();
|
zeek::run_state::detail::run_loop();
|
||||||
|
|
||||||
double time_net_done = zeek::util::current_time(true);
|
double time_net_done = zeek::util::current_time(true);
|
||||||
|
|
||||||
|
|
|
@ -2037,7 +2037,7 @@ double current_time(bool real)
|
||||||
// This obviously only works for a single source ...
|
// This obviously only works for a single source ...
|
||||||
zeek::iosource::PktSrc* src = zeek::iosource_mgr->GetPktSrc();
|
zeek::iosource::PktSrc* src = zeek::iosource_mgr->GetPktSrc();
|
||||||
|
|
||||||
if ( zeek::run_state::net_is_processing_suspended() )
|
if ( zeek::run_state::is_processing_suspended() )
|
||||||
return src->CurrentPacketTimestamp();
|
return src->CurrentPacketTimestamp();
|
||||||
|
|
||||||
// We don't scale with pseudo_realtime here as that would give us a
|
// We don't scale with pseudo_realtime here as that would give us a
|
||||||
|
|
|
@ -269,7 +269,7 @@ static void done_with_network()
|
||||||
zeek::event_mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
zeek::event_mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
zeek::run_state::detail::net_finish(1);
|
zeek::run_state::detail::finish_run(1);
|
||||||
|
|
||||||
#ifdef USE_PERFTOOLS_DEBUG
|
#ifdef USE_PERFTOOLS_DEBUG
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ zeek::detail::SetupResult setup(int argc, char** argv,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dns_type != DNS_PRIME )
|
if ( dns_type != DNS_PRIME )
|
||||||
zeek::run_state::detail::net_init(options.interface, options.pcap_file, options.pcap_output_file, options.use_watchdog);
|
zeek::run_state::detail::init_run(options.interface, options.pcap_file, options.pcap_output_file, options.use_watchdog);
|
||||||
|
|
||||||
if ( ! g_policy_debug )
|
if ( ! g_policy_debug )
|
||||||
{
|
{
|
||||||
|
@ -806,7 +806,7 @@ zeek::detail::SetupResult setup(int argc, char** argv,
|
||||||
if ( ! zeek::run_state::reading_live && ! zeek::run_state::reading_traces )
|
if ( ! zeek::run_state::reading_live && ! zeek::run_state::reading_traces )
|
||||||
// Set up network_time to track real-time, since
|
// Set up network_time to track real-time, since
|
||||||
// we don't have any other source for it.
|
// we don't have any other source for it.
|
||||||
zeek::run_state::detail::net_update_time(zeek::util::current_time());
|
zeek::run_state::detail::update_network_time(zeek::util::current_time());
|
||||||
|
|
||||||
if ( zeek_init )
|
if ( zeek_init )
|
||||||
zeek::event_mgr.Enqueue(zeek_init, zeek::Args{});
|
zeek::event_mgr.Enqueue(zeek_init, zeek::Args{});
|
||||||
|
@ -884,7 +884,7 @@ int cleanup(bool did_net_run)
|
||||||
if ( did_net_run )
|
if ( did_net_run )
|
||||||
done_with_network();
|
done_with_network();
|
||||||
|
|
||||||
zeek::run_state::detail::net_delete();
|
zeek::run_state::detail::delete_run();
|
||||||
terminate_bro();
|
terminate_bro();
|
||||||
|
|
||||||
sqlite3_shutdown();
|
sqlite3_shutdown();
|
||||||
|
@ -911,9 +911,9 @@ void zeek_terminate_loop(const char* reason)
|
||||||
zeek::util::detail::set_processing_status("TERMINATING", reason);
|
zeek::util::detail::set_processing_status("TERMINATING", reason);
|
||||||
zeek::reporter->Info("%s", reason);
|
zeek::reporter->Info("%s", reason);
|
||||||
|
|
||||||
net_get_final_stats();
|
get_final_stats();
|
||||||
zeek::detail::done_with_network();
|
zeek::detail::done_with_network();
|
||||||
net_delete();
|
delete_run();
|
||||||
|
|
||||||
zeek::detail::terminate_bro();
|
zeek::detail::terminate_bro();
|
||||||
|
|
||||||
|
|
|
@ -5012,7 +5012,7 @@ function is_remote_event%(%) : bool
|
||||||
## .. zeek:see:: continue_processing
|
## .. zeek:see:: continue_processing
|
||||||
function suspend_processing%(%) : any
|
function suspend_processing%(%) : any
|
||||||
%{
|
%{
|
||||||
zeek::run_state::net_suspend_processing();
|
zeek::run_state::suspend_processing();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -5021,7 +5021,7 @@ function suspend_processing%(%) : any
|
||||||
## .. zeek:see:: suspend_processing
|
## .. zeek:see:: suspend_processing
|
||||||
function continue_processing%(%) : any
|
function continue_processing%(%) : any
|
||||||
%{
|
%{
|
||||||
zeek::run_state::net_continue_processing();
|
zeek::run_state::continue_processing();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue