Skip to content

Commit 6a6e8f4

Browse files
committed
Add new state pcap_dump_processing_done
1 parent 0913e86 commit 6a6e8f4

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

include/NetworkInterface.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,12 @@ class NetworkInterface : public NetworkInterfaceAlertableEntity {
11931193

11941194
virtual bool read_from_stdin() const { return (false); };
11951195
virtual bool read_from_pcap_dump() const { return (false); };
1196+
11961197
virtual bool read_from_pcap_dump_done() const { return (false); };
11971198
virtual void set_read_from_pcap_dump_done() { ; };
1199+
1200+
virtual bool pcap_dump_processing_done() const { return (false); };
1201+
virtual void set_pcap_dump_processing_done() { ; };
11981202
/*
11991203
Issue a request for user scripts reload. This is called by ntopng when user
12001204
scripts should be reloaded, e.g., after a configuration change.

include/PcapInterface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PcapInterface : public NetworkInterface {
3434
unsigned int ifname_indexes[MAX_NUM_PCAP_INTERFACES];
3535
int iface_datalink[MAX_NUM_PCAP_INTERFACES];
3636
char *pcap_path;
37-
bool read_pkts_from_pcap_dump, read_pkts_from_pcap_dump_done,
37+
bool read_pkts_from_pcap_dump, read_pkts_from_pcap_dump_done, processing_from_pcap_dump_done,
3838
read_pkts_from_directory, emulate_traffic_directions, read_from_stdin_pipe,
3939
delete_pcap_when_done;
4040
ProtoStats prev_stats_in, prev_stats_out;
@@ -85,6 +85,10 @@ class PcapInterface : public NetworkInterface {
8585
return (read_pkts_from_pcap_dump_done);
8686
};
8787
void set_read_from_pcap_dump_done() { read_pkts_from_pcap_dump_done = true; };
88+
bool pcap_dump_processing_done() const {
89+
return (processing_from_pcap_dump_done);
90+
};
91+
void set_pcap_dump_processing_done() { processing_from_pcap_dump_done = true; };
8892
void sendTermination();
8993
bool reproducePcapOriginalSpeed() const;
9094
virtual void updateDirectionStats();

src/PcapInterface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ PcapInterface::PcapInterface(const char *name, u_int8_t ifIdx,
4545
num_ifaces = 0, pcap_list = NULL;
4646
memset(&last_pcap_stat, 0, sizeof(last_pcap_stat));
4747
emulate_traffic_directions = false;
48-
read_pkts_from_pcap_dump = read_pkts_from_pcap_dump_done = false,
48+
read_pkts_from_pcap_dump = read_pkts_from_pcap_dump_done = false, processing_from_pcap_dump_done = false,
4949
read_pkts_from_directory = false, read_from_stdin_pipe = false;
5050

5151
firstPktTS.tv_sec = 0;
@@ -448,6 +448,8 @@ static void *packetPollLoop(void *ptr) {
448448
for (int i = 0; i < 2; i++)
449449
iface->purgeIdle(time(NULL), false, true /* Full scan */);
450450

451+
iface->set_pcap_dump_processing_done();
452+
451453
ntop->getTrace()->traceEvent(TRACE_NORMAL, "Terminated packet polling for %s",
452454
iface->get_description());
453455

0 commit comments

Comments
 (0)