Checkpointing the dynamic plugin code.

This is essentially the code from the dynamic-plugin branch except for
some pieces that I have split out into separate, earlier commits.

I'm going to updatre things in this branch going forward.
This commit is contained in:
Robin Sommer 2013-11-26 11:23:25 -08:00
parent 7412470d66
commit 555df1e7ea
43 changed files with 1306 additions and 110 deletions

View file

@ -30,6 +30,7 @@
#include "PacketSort.h"
#include "Serializer.h"
#include "PacketDumper.h"
#include "plugin/Manager.h"
extern "C" {
#include "setsignal.h"
@ -144,13 +145,17 @@ RETSIGTYPE watchdog(int /* signo */)
return RETSIGVAL;
}
void net_update_time(double new_network_time)
{
network_time = new_network_time;
plugin_mgr->UpdateNetworkTime(network_time);
}
void net_init(name_list& interfaces, name_list& readfiles,
name_list& netflows, name_list& flowfiles,
const char* writefile, const char* filter,
const char* secondary_filter, int do_watchdog)
{
init_net_var();
if ( readfiles.length() > 0 || flowfiles.length() > 0 )
{
reading_live = pseudo_realtime > 0.0;
@ -323,7 +328,7 @@ void net_packet_dispatch(double t, const struct pcap_pkthdr* hdr,
: timer_mgr;
// network_time never goes back.
network_time = tmgr->Time() < t ? t : tmgr->Time();
net_update_time(tmgr->Time() < t ? t : tmgr->Time());
current_pktsrc = src_ps;
current_iosrc = src_ps;
@ -456,7 +461,7 @@ void net_run()
{
// Take advantage of the lull to get up to
// date on timers and events.
network_time = ct;
net_update_time(ct);
expire_timers();
usleep(1); // Just yield.
}
@ -478,7 +483,7 @@ void net_run()
// date on timers and events. Because we only
// have timers as sources, going to sleep here
// doesn't risk blocking on other inputs.
network_time = current_time();
net_update_time(current_time());
expire_timers();
// Avoid busy-waiting - pause for 100 ms.