Coverage Report

Created: 2025-12-31 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ntopng/include/FlowChecksLoader.h
Line
Count
Source
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 _FLOW_CHECKS_LOADER_H_
23
#define _FLOW_CHECKS_LOADER_H_
24
25
#include "ntop_includes.h"
26
27
class FlowChecksLoader
28
    : public ChecksLoader { /* A single instance inside Ntop */
29
 private:
30
  /* nDPI risks not currently hanlded by registered checks */
31
  ndpi_risk unhandled_ndpi_risks;
32
  /* These are check instances, that is classes instantiated at runtime each one
33
   * with a given configuration */
34
  std::map<std::string, FlowCheck *> cb_all; /* All the checks instantiated */
35
36
  std::list<FlowCheck *> *getChecks(NetworkInterface *iface, FlowChecks check);
37
  void registerCheck(FlowCheck *cb);
38
39
  void registerChecks();
40
  void loadConfiguration();
41
42
 public:
43
  FlowChecksLoader();
44
  virtual ~FlowChecksLoader();
45
46
  void printChecks();
47
48
  inline std::list<FlowCheck *> *getProtocolDetectedChecks(
49
0
      NetworkInterface *iface) {
50
0
    return (getChecks(iface, flow_check_protocol_detected));
51
0
  }
52
  inline std::list<FlowCheck *> *getPeriodicUpdateChecks(
53
0
      NetworkInterface *iface) {
54
0
    return (getChecks(iface, flow_check_periodic_update));
55
0
  }
56
0
  inline std::list<FlowCheck *> *getFlowEndChecks(NetworkInterface *iface) {
57
0
    return (getChecks(iface, flow_check_flow_end));
58
0
  }
59
0
  inline std::list<FlowCheck *> *getFlowBeginChecks(NetworkInterface *iface) {
60
0
    return (getChecks(iface, flow_check_flow_begin));
61
0
  }
62
0
  inline std::list<FlowCheck *> *getNoneFlowChecks(NetworkInterface *iface) {
63
0
    return (getChecks(iface, flow_check_flow_none));
64
0
  }
65
0
  inline ndpi_risk getUnhandledRisks() const { return unhandled_ndpi_risks; };
66
0
  inline bool isRiskUnhandled(ndpi_risk_enum risk) const {
67
0
    return NDPI_ISSET_BIT(unhandled_ndpi_risks, risk);
68
0
  };
69
  bool luaCheckInfo(lua_State *vm, std::string check_name) const;
70
  void lua(lua_State *vm);
71
};
72
73
#endif /* _FLOW_CHECKS_LOADER_H_ */