diff --git a/include/NetworkInterface.h b/include/NetworkInterface.h index b4659edcf8..f0586214b9 100644 --- a/include/NetworkInterface.h +++ b/include/NetworkInterface.h @@ -705,16 +705,4 @@ class NetworkInterface : public Checkpointable { #endif }; -class NetworkInterfaceTsPoint: public TimeseriesPoint { - public: - nDPIStats ndpi; - LocalTrafficStats local_stats; - u_int hosts, local_hosts; - u_int devices, flows, http_hosts; - TcpPacketStats tcpPacketStats; - PacketStats packetStats; - - virtual void lua(lua_State* vm, NetworkInterface *iface); -}; - #endif /* _NETWORK_INTERFACE_H_ */ diff --git a/include/NetworkInterfaceTsPoint.h b/include/NetworkInterfaceTsPoint.h new file mode 100644 index 0000000000..5c5f117e05 --- /dev/null +++ b/include/NetworkInterfaceTsPoint.h @@ -0,0 +1,39 @@ +/* + * + * (C) 2013-18 - ntop.org + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _NETWORK_INTERFACE_TS_POINT_H_ +#define _NETWORK_INTERFACE_TS_POINT_H_ + +#include "ntop_includes.h" + +class NetworkInterfaceTsPoint: public TimeseriesPoint { + public: + nDPIStats ndpi; + LocalTrafficStats local_stats; + u_int hosts, local_hosts; + u_int devices, flows, http_hosts; + TcpPacketStats tcpPacketStats; + PacketStats packetStats; + + virtual void lua(lua_State* vm, NetworkInterface *iface); +}; + +#endif /* _NETWORK_INTERFACE_TS_POINT_H_ */ diff --git a/include/ntop_includes.h b/include/ntop_includes.h index 21bcfdc6e2..22a9725bf8 100644 --- a/include/ntop_includes.h +++ b/include/ntop_includes.h @@ -249,6 +249,7 @@ using namespace std; #include "TimeseriesRing.h" #include "HostTimeseriesPoint.h" #include "SPSCQueue.h" +#include "NetworkInterfaceTsPoint.h" #include "NetworkInterface.h" #ifndef HAVE_NEDGE #include "PcapInterface.h" diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index 19fa0c511c..e638ba4549 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -350,25 +350,6 @@ void NetworkInterface::init() { /* **************************************************** */ -void NetworkInterfaceTsPoint::lua(lua_State* vm, NetworkInterface *iface) { - ndpi.lua(iface, vm, true /* with categories */); - local_stats.lua(vm); - tcpPacketStats.lua(vm, "tcpPacketStats"); - packetStats.lua(vm, "pktSizeDistribution"); - - lua_newtable(vm); - lua_push_int_table_entry(vm, "hosts", hosts); - lua_push_int_table_entry(vm, "local_hosts", local_hosts); - lua_push_int_table_entry(vm, "devices", devices); - lua_push_int_table_entry(vm, "flows", flows); - lua_push_int_table_entry(vm, "http_hosts", http_hosts); - lua_pushstring(vm, "stats"); - lua_insert(vm, -2); - lua_settable(vm, -3); -} - -/* **************************************************** */ - #ifdef NTOPNG_PRO void NetworkInterface::initL7Policer() { diff --git a/src/NetworkInterfaceTsPoint.cpp b/src/NetworkInterfaceTsPoint.cpp new file mode 100644 index 0000000000..2fece275c1 --- /dev/null +++ b/src/NetworkInterfaceTsPoint.cpp @@ -0,0 +1,41 @@ +/* + * + * (C) 2013-18 - ntop.org + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "ntop_includes.h" + +/* *************************************** */ + +void NetworkInterfaceTsPoint::lua(lua_State* vm, NetworkInterface *iface) { + ndpi.lua(iface, vm, true /* with categories */); + local_stats.lua(vm); + tcpPacketStats.lua(vm, "tcpPacketStats"); + packetStats.lua(vm, "pktSizeDistribution"); + + lua_newtable(vm); + lua_push_int_table_entry(vm, "hosts", hosts); + lua_push_int_table_entry(vm, "local_hosts", local_hosts); + lua_push_int_table_entry(vm, "devices", devices); + lua_push_int_table_entry(vm, "flows", flows); + lua_push_int_table_entry(vm, "http_hosts", http_hosts); + lua_pushstring(vm, "stats"); + lua_insert(vm, -2); + lua_settable(vm, -3); +}