- Implemented object loading from server
[public/netxms.git] / include / nxclapi.h
CommitLineData
80ffed5a
VK
1/*
2** NetXMS - Network Management System
3** Client Library API
4** Copyright (C) 2004 Victor Kirhenshtein
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 2 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
18** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19**
20** $module: nxclapi.h
21**
22**/
23
24#ifndef _nxclapi_h_
25#define _nxclapi_h_
26
27#include <nms_common.h>
28
29
0c8bf759
VK
30//
31// Some constants
32//
33
34#define MAX_OBJECT_NAME 64
35#define MAX_COMMUNITY_LENGTH 32
36#define MAX_OID_LENGTH 1024
37
38
71c18491
VK
39//
40// Authentication methods
41//
42
43#define AUTH_NONE 0
44#define AUTH_PLAINTEXT 1
45#define AUTH_MD5_HASH 2
46#define AUTH_SHA1_HASH 3
47
48
49//
50// Object types
51//
52
53#define OBJECT_GENERIC 0
54#define OBJECT_SUBNET 1
55#define OBJECT_NODE 2
56#define OBJECT_INTERFACE 3
57#define OBJECT_NETWORK 4
58
59
5fad5c32
VK
60//
61// Events
62//
63
64#define NXC_EVENT_STATE_CHANGED 1
71f8d3d7 65#define NXC_EVENT_ERROR 2
c7f4f5a9 66#define NXC_EVENT_LOGIN_RESULT 3
71f8d3d7
VK
67
68
69//
70// Errors
71//
72
73#define NXC_ERR_INTERNAL 1
5fad5c32
VK
74
75
54481027
VK
76//
77// States
78//
79
80#define STATE_DISCONNECTED 0
81#define STATE_CONNECTING 1
82#define STATE_IDLE 2
7e986059
VK
83#define STATE_SYNC_OBJECTS 3
84#define STATE_SYNC_EVENTS 4
85
86
87//
88// Operations
89//
90
91#define NXC_OP_SYNC_OBJECTS 1
0c8bf759 92#define NXC_OP_SYNC_EVENTS 2
54481027
VK
93
94
95//
0c8bf759 96// Callbacks data types
54481027
VK
97//
98
99typedef void (* NXC_EVENT_HANDLER)(DWORD dwEvent, DWORD dwCode, void *pArg);
5d63b3c1 100typedef void (* NXC_DEBUG_CALLBACK)(char *pMsg);
54481027
VK
101
102
0c8bf759
VK
103//
104// Network object structure
105//
106
107typedef struct
108{
109 DWORD dwId; // Unique object's identifier
110 int iClass; // Object's class
111 int iStatus; // Object's status
112 DWORD dwIpAddr; // IP address
113 char szName[MAX_OBJECT_NAME];
114 DWORD dwNumParents;
115 DWORD *pdwParentList;
116 DWORD dwNumChilds;
117 DWORD *pdwChildList;
118 union
119 {
120 struct
121 {
122 DWORD dwIpNetMask; // Ip netmask.
123 DWORD dwIfIndex; // Interface index.
124 DWORD dwIfType; // Interface type
125 } iface;
126 struct
127 {
128 DWORD dwFlags;
129 DWORD dwDiscoveryFlags;
130 char szSharedSecret[MAX_SECRET_LENGTH];
131 char szCommunityString[MAX_COMMUNITY_LENGTH];
132 char szObjectId[MAX_OID_LENGTH];
133 WORD wAgentPort; // Listening TCP port for native agent
134 WORD wAuthMethod; // Native agent's authentication method
135 } node;
136 struct
137 {
138 DWORD dwIpNetMask;
139 } subnet;
140 };
141} NXC_OBJECT;
142
143
80ffed5a
VK
144//
145// Functions
146//
147
148#ifdef __cplusplus
149extern "C" {
150#endif
151
54481027
VK
152DWORD EXPORTABLE NXCGetVersion(void);
153BOOL EXPORTABLE NXCInitialize(void);
71f8d3d7 154BOOL EXPORTABLE NXCConnect(char *szServer, char *szLogin, char *szPassword);
54481027
VK
155void EXPORTABLE NXCDisconnect(void);
156void EXPORTABLE NXCSetEventHandler(NXC_EVENT_HANDLER pHandler);
5d63b3c1 157void EXPORTABLE NXCSetDebugCallback(NXC_DEBUG_CALLBACK pFunc);
54481027 158int EXPORTABLE NXCRequest(DWORD dwOperation, ...);
80ffed5a
VK
159
160#ifdef __cplusplus
161}
162#endif
163
164
7e986059
VK
165//
166// Macros
167//
168
169#define NXCSyncObjects() NXCRequest(NXC_OP_SYNC_OBJECTS)
170
171
80ffed5a 172#endif /* _nxclapi_h_ */