Coverage Report

Created: 2026-09-14 06:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ntopng/include/ZMQCollectorInterface.h
Line
Count
Source
1
/*
2
 *
3
 * (C) 2013-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 _ZMQ_COLLECTOR_INTERFACE_H_
23
#define _ZMQ_COLLECTOR_INTERFACE_H_
24
25
#include "ntop_includes.h"
26
27
#ifdef HAVE_ZMQ
28
#ifndef HAVE_NEDGE
29
30
class LuaEngine;
31
32
class ZMQCollectorInterface : public ZMQParserInterface {
33
 private:
34
  void* context;
35
  std::unordered_map<u_int32_t /* source_id */, zmq_probe*> active_probes;
36
  char* zmq_decompress_buf;
37
  bool is_collector;
38
  u_int16_t num_subscribers;
39
  zmq_subscriber subscriber[MAX_ZMQ_SUBSCRIBERS];
40
  char server_public_key[41], server_secret_key[41];
41
  bool using_default_encryption_key;
42
43
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0)
44
  char* findInterfaceEncryptionKeys(char* public_key, char* secret_key,
45
                                    int public_key_len, int secret_key_len);
46
#endif
47
  void checkIdleProbes(time_t now);
48
49
 public:
50
  ZMQCollectorInterface(const char* _endpoint);
51
  ~ZMQCollectorInterface();
52
53
0
  virtual const char* get_type() const { return (CONST_INTERFACE_TYPE_ZMQ); };
54
0
  inline char* getEndpoint(u_int8_t id) {
55
0
    return ((id < num_subscribers) ? subscriber[id].endpoint : (char*)"");
56
0
  };
57
0
  virtual bool isPacketInterface() const { return (false); };
58
  void collect_flows();
59
0
  virtual bool is_ndpi_enabled() const {
60
0
    return (true /* Needed by blacklists and risks */);
61
0
  };
62
  virtual void purgeIdle(time_t when, bool force_idle = false,
63
                         bool full_scan = false);
64
65
  void startPacketPolling();
66
  bool set_packet_filter(char* filter);
67
  virtual void lua(lua_State* vm, bool fullStats);
68
0
  virtual bool areTrafficDirectionsSupported() { return (true); };
69
};
70
71
#endif /* HAVE_NEDGE */
72
73
#endif /* _ZMQ_COLLECTOR_INTERFACE_H_ */
74
#endif