added missing project file; fixed Windows build errors
[public/netxms.git] / include / nxcc.h
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 /**
21 * Cluster node states
22 */
23 enum ClusterNodeState
24 {
25 CLUSTER_NODE_DOWN = 0,
26 CLUSTER_NODE_CONNECTED = 1,
27 CLUSTER_NODE_UP = 2
28 };
29
30 /**
31 * Cluster node event handler
32 */
33 class LIBNXCC_EXPORTABLE ClusterEventHandler
34 {
35 public:
36 ClusterEventHandler();
37 virtual ~ClusterEventHandler();
38
39 virtual void onNodeJoin(UINT32 nodeId);
40 virtual void onNodeDisconnect(UINT32 nodeId);
41 virtual void onShutdown();
42
43 virtual void onMessage(NXCPMessage *msg, UINT32 sourceNodeId);
44 };
45
46 /**
47 * API functions
48 */
49 bool LIBNXCC_EXPORTABLE ClusterInit(Config *config, const TCHAR *section, ClusterEventHandler *eventHandler);
50 bool LIBNXCC_EXPORTABLE ClusterJoin();
51 void LIBNXCC_EXPORTABLE ClusterShutdown();
52
53 void LIBNXCC_EXPORTABLE ClusterSetDebugCallback(void (*cb)(int, const TCHAR *, va_list));
54
55 bool LIBNXCC_EXPORTABLE ClusterIsMasterNode();
56
57 #endif