/src/ntopng/include/FlowStats.h
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * (C) 2019-26 - ntop.org |
4 | | * |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program; if not, write to the Free Software Foundation, |
18 | | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | | * |
20 | | */ |
21 | | |
22 | | #ifndef _FLOW_STATUS_STATS_H_ |
23 | | #define _FLOW_STATUS_STATS_H_ |
24 | | |
25 | | #include "ntop_includes.h" |
26 | | |
27 | | class Flow; /* Forward */ |
28 | | |
29 | | /* *************************************** */ |
30 | | |
31 | | class FlowStats { |
32 | | private: |
33 | | u_int32_t counters[BITMAP_NUM_BITS]; |
34 | | u_int32_t protocols[0x100]; |
35 | | u_int32_t alert_levels[ALERT_LEVEL_MAX_LEVEL]; |
36 | | u_int32_t dscps[64]; // 64 values available for dscp |
37 | | u_int32_t host_pools[UNLIMITED_NUM_HOST_POOLS]; |
38 | | std::map<std::string, u_int16_t> talking_hosts; |
39 | | std::map<std::string, u_int16_t> wlan_ssid; |
40 | | std::set<u_int32_t> transit_asn_list; |
41 | | std::map<u_int32_t, u_int32_t> src_asn; |
42 | | std::map<u_int32_t, u_int32_t> dst_asn; |
43 | | |
44 | | public: |
45 | | FlowStats(); |
46 | | ~FlowStats(); |
47 | | |
48 | | void incStats(Bitmap128 alert_bitmap, u_int8_t l4_protocol, |
49 | | AlertLevel alert_level, u_int8_t dscp_cli2srv, |
50 | | u_int8_t dscp_srv2cli, Flow *flow); |
51 | | |
52 | | void updateTalkingHosts(Flow *f); |
53 | | void updateWLANSSID(Flow *f); |
54 | | |
55 | | void lua(lua_State *vm); |
56 | | |
57 | | void resetStats(); |
58 | 0 | void resetTalkingHosts() { talking_hosts.clear(); }; |
59 | | }; |
60 | | |
61 | | #endif /* _FLOW_STATUS_STATS_H_ */ |