/src/ntopng/include/HostCheck.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * |
3 | | * (C) 2013-25 - 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 _HOST_CHECK_H_ |
23 | | #define _HOST_CHECK_H_ |
24 | | |
25 | | #include "ntop_includes.h" |
26 | | |
27 | | class HostCheck : public Check { |
28 | | private: |
29 | | u_int32_t periodicity_secs; |
30 | | |
31 | | public: |
32 | | HostCheck(NtopngEdition _edition, bool _packet_interface_only, |
33 | | bool _nedge_exclude, bool _nedge_only); |
34 | | virtual ~HostCheck(); |
35 | | |
36 | | /* Check hook (periodic) |
37 | | * engaged_alert is the alert already engaged by the check |
38 | | * in a previous iteration, if any. */ |
39 | 0 | virtual void periodicUpdate(Host *h, HostAlert *engaged_alert){}; |
40 | | |
41 | 0 | virtual u_int32_t getPeriod() { return periodicity_secs; } |
42 | 0 | inline bool isMinCheck() const { return periodicity_secs == 60; }; |
43 | 0 | inline bool is5MinCheck() const { return periodicity_secs == 300; }; |
44 | | |
45 | 0 | inline void enable(u_int32_t _periodicity_secs) { |
46 | 0 | Check::enable(); |
47 | 0 | periodicity_secs = _periodicity_secs; |
48 | 0 | } |
49 | | |
50 | 0 | inline void addCheck(std::list<HostCheck *> *l, NetworkInterface *iface) { |
51 | 0 | l->push_back(this); |
52 | 0 | } |
53 | | virtual bool loadConfiguration(json_object *config); |
54 | | |
55 | | virtual HostCheckID getID() const = 0; |
56 | | virtual std::string getName() const = 0; |
57 | | }; |
58 | | |
59 | | #endif /* _HOST_CHECK_H_ */ |