fixed Windows build error
[public/netxms.git] / include / nxcc.h
CommitLineData
a7a4c1e9
VK
1#ifndef _nxcc_h_
2#define _nxcc_h_
3
4#ifdef _WIN32
5#ifdef LIBNXCC_EXPORTS
6#define LIBNXCC_EXPORTABLE __declspec(dllexport)
7#else
8#define LIBNXCC_EXPORTABLE __declspec(dllimport)
9#endif
10#else /* _WIN32 */
11#define LIBNXCC_EXPORTABLE
12#endif
13
14#include <nms_common.h>
15#include <nms_util.h>
16#include <nms_threads.h>
17#include <nxcpapi.h>
18#include <nxconfig.h>
19
20/**
5cf931e2
VK
21 * Cluster error codes
22 */
23#define NXCC_RCC_SUCCESS 0
24#define NXCC_RCC_INVALID_NODE 1
25#define NXCC_RCC_TIMEOUT 2
26#define NXCC_RCC_COMM_FAILURE 3
27
28/**
a7a4c1e9
VK
29 * Cluster node states
30 */
31enum ClusterNodeState
32{
33 CLUSTER_NODE_DOWN = 0,
34 CLUSTER_NODE_CONNECTED = 1,
35 CLUSTER_NODE_UP = 2
36};
37
38/**
39 * Cluster node event handler
40 */
4f239fa3 41class LIBNXCC_EXPORTABLE ClusterEventHandler
a7a4c1e9
VK
42{
43public:
44 ClusterEventHandler();
45 virtual ~ClusterEventHandler();
46
47 virtual void onNodeJoin(UINT32 nodeId);
48 virtual void onNodeDisconnect(UINT32 nodeId);
49 virtual void onShutdown();
50
5cf931e2 51 virtual bool onMessage(NXCPMessage *msg, UINT32 sourceNodeId);
a7a4c1e9
VK
52};
53
54/**
55 * API functions
56 */
57bool LIBNXCC_EXPORTABLE ClusterInit(Config *config, const TCHAR *section, ClusterEventHandler *eventHandler);
58bool LIBNXCC_EXPORTABLE ClusterJoin();
59void LIBNXCC_EXPORTABLE ClusterShutdown();
60
61void LIBNXCC_EXPORTABLE ClusterSetDebugCallback(void (*cb)(int, const TCHAR *, va_list));
62
63bool LIBNXCC_EXPORTABLE ClusterIsMasterNode();
64
5cf931e2
VK
65void LIBNXCC_EXPORTABLE ClusterNotify(NXCPMessage *msg);
66int LIBNXCC_EXPORTABLE ClusterSendCommand(NXCPMessage *msg);
67UINT32 LIBNXCC_EXPORTABLE ClusterSendDirectCommand(UINT32 nodeId, NXCPMessage *msg);
68NXCPMessage LIBNXCC_EXPORTABLE *ClusterSendDirectCommandEx(UINT32 nodeId, NXCPMessage *msg);
69void LIBNXCC_EXPORTABLE ClusterSendResponse(UINT32 nodeId, UINT32 requestId, UINT32 rcc);
70
a7a4c1e9 71#endif