Coverage Report

Created: 2024-02-25 06:37

/src/ntopng/include/ZMQPublisher.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *
3
 * (C) 2019-24 - ntop.org
4
 *
5
 *  http://www.ntop.org/
6
 *
7
 * This code is proprietary code subject to the terms and conditions
8
 * defined in LICENSE file which is part of this source code package.
9
 *
10
 */
11
12
#include "ntop_includes.h"
13
14
/**
15
 * @file ZMQPublisher.h
16
 *
17
 * @brief      ZMQPublisher class implementation.
18
 * @details    ZMQPublisher exports events using a ZMQ socket.
19
 */
20
21
#ifndef _ZMQ_PUBLISHER_H_
22
#define _ZMQ_PUBLISHER_H_
23
24
#ifdef HAVE_ZMQ
25
26
class ZMQPublisher {
27
 private:
28
  void *context; /**< ZMQ context */
29
  void *pub_socket; /**< ZMQ publisher socket */
30
  char server_public_key[41];
31
  char server_secret_key[41];
32
33
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0)
34
  int setServerEncryptionKeys(const char *secret_key);
35
  int setClientEncryptionKeys(const char *server_public_key);
36
#endif
37
  bool sendMessage(const char *topic, char *str);
38
39
 public:
40
  ZMQPublisher(char *endpoint);
41
  ~ZMQPublisher();
42
43
0
  inline bool sendIPSMessage(char *msg)     { return (sendMessage("ips", msg)); }
44
0
  inline bool sendControlMessage(char *msg) { return (sendMessage("message", msg)); }
45
};
46
47
#endif /* HAVE_ZMQ */
48
49
#endif /* _ZMQ_PUBLISHER_H_ */