Added OSPF support detection
[public/netxms.git] / include / nxclapi.h
CommitLineData
80ffed5a
VK
1/*
2** NetXMS - Network Management System
3** Client Library API
1c8b8363 4** Copyright (C) 2004, 2005 Victor Kirhenshtein
80ffed5a
VK
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>
e641b7d0 28#include <nms_util.h>
5ebea5e0 29#include <nxevent.h>
03ea8b3d 30#include <nximage.h>
8c290af0 31#include <nxcscpapi.h>
80ffed5a 32
8aeffdee
VK
33#ifdef _WIN32
34#ifdef LIBNXCL_EXPORTS
35#define LIBNXCL_EXPORTABLE __declspec(dllexport)
36#else
37#define LIBNXCL_EXPORTABLE __declspec(dllimport)
38#endif
39#else /* _WIN32 */
40#define LIBNXCL_EXPORTABLE
41#endif
42
80ffed5a 43
41213c24
VK
44//
45// Session handle type
46//
47
48typedef void * NXC_SESSION;
49
50
0c8bf759
VK
51//
52// Some constants
53//
54
878c92bc
VK
55#define MAX_OBJECT_NAME 64
56#define MAX_COMMUNITY_LENGTH 32
57#define MAX_OID_LENGTH 1024
58#define MAX_EVENT_MSG_LENGTH 256
59#define MAX_EVENT_NAME 64
5ac3236b 60#define MAX_USER_NAME 64
54abbe0e
VK
61#define MAX_USER_FULLNAME 128
62#define MAX_USER_DESCR 256
7ec6cca8
VK
63#define MAX_ITEM_NAME 256
64#define MAX_STRING_VALUE 256
d096bcdd 65#define MAX_AGENT_VERSION_LEN 64
1c8b8363 66#define MAX_PLATFORM_NAME_LEN 64
257defd7 67#define MAX_PACKAGE_NAME_LEN 64
8c18110a
VK
68#define GROUP_FLAG ((DWORD)0x80000000)
69#define GROUP_EVERYONE ((DWORD)0x80000000)
70#define INVALID_UID ((DWORD)0xFFFFFFFF)
aa3743b2 71#define OBJECT_STATUS_COUNT 9
4ae6b70e
VK
72#define MAX_RCPT_ADDR_LEN 256
73#define MAX_EMAIL_SUBJECT_LEN 256
b50f1100 74#define MAC_ADDR_LENGTH 6
aa3743b2
VK
75
76
77//
78// Image formats
79//
80
81#define IMAGE_FORMAT_ICO 0
82#define IMAGE_FORMAT_PNG 1
0c8bf759
VK
83
84
71c18491
VK
85//
86// Authentication methods
87//
88
4de204a3
VK
89#define AUTH_NONE 0
90#define AUTH_PLAINTEXT 1
91#define AUTH_MD5_HASH 2
92#define AUTH_SHA1_HASH 3
71c18491
VK
93
94
0b89f5fb
VK
95//
96// Forced poll types
97//
98
99#define POLL_STATUS 1
100#define POLL_CONFIGURATION 2
101
102
71c18491
VK
103//
104// Object types
105//
106
4de204a3
VK
107#define OBJECT_GENERIC 0
108#define OBJECT_SUBNET 1
109#define OBJECT_NODE 2
110#define OBJECT_INTERFACE 3
111#define OBJECT_NETWORK 4
112#define OBJECT_CONTAINER 5
113#define OBJECT_ZONE 6
114#define OBJECT_SERVICEROOT 7
b50f1100 115#define OBJECT_TEMPLATE 8
62d11997
VK
116#define OBJECT_TEMPLATEGROUP 9
117#define OBJECT_TEMPLATEROOT 10
bebf4833 118#define OBJECT_NETWORKSERVICE 11
71c18491
VK
119
120
9eb7685c
VK
121//
122// Object's status
123//
124
4de204a3
VK
125#define STATUS_NORMAL 0
126#define STATUS_WARNING 1
127#define STATUS_MINOR 2
128#define STATUS_MAJOR 3
129#define STATUS_CRITICAL 4
130#define STATUS_UNKNOWN 5
131#define STATUS_UNMANAGED 6
132#define STATUS_DISABLED 7
133#define STATUS_TESTING 8
134
135
136//
137// Event and alarm severity
138//
139
140#define SEVERITY_NORMAL 0
141#define SEVERITY_WARNING 1
142#define SEVERITY_MINOR 2
143#define SEVERITY_MAJOR 3
144#define SEVERITY_CRITICAL 4
145#define SEVERITY_FROM_EVENT 5
146#define SEVERITY_NONE 6
9eb7685c
VK
147
148
4d597931
VK
149//
150// Node flags
151//
152
153#define NF_IS_SNMP 0x0001
154#define NF_IS_NATIVE_AGENT 0x0002
155#define NF_IS_BRIDGE 0x0004
156#define NF_IS_ROUTER 0x0008
157#define NF_IS_LOCAL_MGMT 0x0010
a7d07192 158#define NF_IS_PRINTER 0x0020
0ff9b273 159#define NF_IS_OSPF 0x0040
4d597931
VK
160
161
bebf4833
VK
162//
163// Service types
164//
165
166#define NETSRV_CUSTOM 0
167#define NETSRV_SSH 1
168#define NETSRV_POP3 2
169#define NETSRV_SMTP 3
170#define NETSRV_FTP 4
171#define NETSRV_HTTP 5
172
173
5fad5c32
VK
174//
175// Events
176//
177
41213c24
VK
178#define NXC_EVENT_ERROR 1
179#define NXC_EVENT_NEW_ELOG_RECORD 2
180#define NXC_EVENT_USER_DB_CHANGED 3
181#define NXC_EVENT_OBJECT_CHANGED 4
182#define NXC_EVENT_NOTIFICATION 5
71f8d3d7
VK
183
184
185//
186// Errors
187//
188
189#define NXC_ERR_INTERNAL 1
5fad5c32
VK
190
191
54481027 192//
39d7a7ed 193// States (used both by client library and server)
54481027
VK
194//
195
196#define STATE_DISCONNECTED 0
197#define STATE_CONNECTING 1
39d7a7ed
VK
198#define STATE_CONNECTED 2
199#define STATE_AUTHENTICATED 3
7e986059
VK
200
201
b601b1fa
VK
202//
203// Notification codes
204//
205
3421c063
VK
206#define NX_NOTIFY_SHUTDOWN 1
207#define NX_NOTIFY_EVENTDB_CHANGED 2
4de204a3
VK
208#define NX_NOTIFY_ALARM_DELETED 3
209#define NX_NOTIFY_NEW_ALARM 4
eb484131 210#define NX_NOTIFY_ALARM_ACKNOWLEGED 5
c9363772
VK
211#define NX_NOTIFY_ACTION_CREATED 6
212#define NX_NOTIFY_ACTION_MODIFIED 7
213#define NX_NOTIFY_ACTION_DELETED 8
878c92bc
VK
214
215
216//
217// Request completion codes
218//
219
220#define RCC_SUCCESS ((DWORD)0)
221#define RCC_COMPONENT_LOCKED ((DWORD)1)
222#define RCC_ACCESS_DENIED ((DWORD)2)
223#define RCC_INVALID_REQUEST ((DWORD)3)
224#define RCC_TIMEOUT ((DWORD)4)
605d2931
VK
225#define RCC_OUT_OF_STATE_REQUEST ((DWORD)5)
226#define RCC_DB_FAILURE ((DWORD)6)
effb51ab 227#define RCC_INVALID_OBJECT_ID ((DWORD)7)
34d95c13 228#define RCC_ALREADY_EXIST ((DWORD)8)
2e29457d 229#define RCC_COMM_FAILURE ((DWORD)9)
0d9c1b96 230#define RCC_SYSTEM_FAILURE ((DWORD)10)
62f3f072 231#define RCC_INVALID_USER_ID ((DWORD)11)
7ec6cca8 232#define RCC_INVALID_ARGUMENT ((DWORD)12)
9ed4eaff
VK
233#define RCC_DUPLICATE_DCI ((DWORD)13)
234#define RCC_INVALID_DCI_ID ((DWORD)14)
a7d07192
VK
235#define RCC_OUT_OF_MEMORY ((DWORD)15)
236#define RCC_IO_ERROR ((DWORD)16)
e6b958c4 237#define RCC_INCOMPATIBLE_OPERATION ((DWORD)17)
917aa2e6
VK
238#define RCC_OBJECT_CREATION_FAILED ((DWORD)18)
239#define RCC_OBJECT_LOOP ((DWORD)19)
8f7e2482 240#define RCC_INVALID_OBJECT_NAME ((DWORD)20)
9e41df77 241#define RCC_INVALID_ALARM_ID ((DWORD)21)
15b8d488 242#define RCC_INVALID_ACTION_ID ((DWORD)22)
0b89f5fb 243#define RCC_OPERATION_IN_PROGRESS ((DWORD)23)
933aee5c 244#define RCC_DCI_COPY_ERRORS ((DWORD)24)
b562fca8 245#define RCC_INVALID_EVENT_CODE ((DWORD)25)
ed1140dc
VK
246#define RCC_NO_WOL_INTERFACES ((DWORD)26)
247#define RCC_NO_MAC_ADDRESS ((DWORD)27)
37c4d6aa 248#define RCC_NOT_IMPLEMENTED ((DWORD)28)
106e7ae3 249#define RCC_INVALID_TRAP_ID ((DWORD)29)
2e0596dd 250#define RCC_DCI_NOT_SUPPORTED ((DWORD)30)
693119d6 251#define RCC_VERSION_MISMATCH ((DWORD)31)
17322e0b 252#define RCC_NPI_PARSE_ERROR ((DWORD)32)
257defd7
VK
253#define RCC_DUPLICATE_PACKAGE ((DWORD)33)
254#define RCC_PACKAGE_FILE_EXIST ((DWORD)34)
255#define RCC_RESOURCE_BUSY ((DWORD)35)
f6aa542e 256#define RCC_INVALID_PACKAGE_ID ((DWORD)36)
6c60ff91 257#define RCC_INVALID_IP_ADDR ((DWORD)37)
878c92bc
VK
258
259
d9152256
VK
260//
261// Mask bits for NXCModifyEventTemplate()
262//
263
264#define EM_SEVERITY ((DWORD)0x01)
265#define EM_FLAGS ((DWORD)0x02)
266#define EM_NAME ((DWORD)0x04)
267#define EM_MESSAGE ((DWORD)0x08)
268#define EM_DESCRIPTION ((DWORD)0x10)
269#define EM_ALL ((DWORD)0x1F)
270
271
effb51ab
VK
272//
273// Mask bits (flags) for NXCModifyObject()
274//
275
70573ffe
VK
276#define OBJ_UPDATE_NAME ((DWORD)0x0001)
277#define OBJ_UPDATE_AGENT_PORT ((DWORD)0x0002)
278#define OBJ_UPDATE_AGENT_AUTH ((DWORD)0x0004)
279#define OBJ_UPDATE_AGENT_SECRET ((DWORD)0x0008)
280#define OBJ_UPDATE_SNMP_VERSION ((DWORD)0x0010)
281#define OBJ_UPDATE_SNMP_COMMUNITY ((DWORD)0x0020)
282#define OBJ_UPDATE_ACL ((DWORD)0x0040)
283#define OBJ_UPDATE_IMAGE ((DWORD)0x0080)
284#define OBJ_UPDATE_DESCRIPTION ((DWORD)0x0100)
d780a7bc
VK
285#define OBJ_UPDATE_SERVICE_TYPE ((DWORD)0x0200)
286#define OBJ_UPDATE_IP_PROTO ((DWORD)0x0400)
287#define OBJ_UPDATE_IP_PORT ((DWORD)0x0800)
288#define OBJ_UPDATE_CHECK_REQUEST ((DWORD)0x1000)
289#define OBJ_UPDATE_CHECK_RESPONCE ((DWORD)0x2000)
290#define OBJ_UPDATE_POLLER_NODE ((DWORD)0x4000)
89ced6da 291#define OBJ_UPDATE_IP_ADDR ((DWORD)0x8000)
d780a7bc 292
89ced6da
VK
293#define OBJ_UPDATE_NODE_ALL ((DWORD)0x41FF)
294#define OBJ_UPDATE_NETSRV_ALL ((DWORD)0xFEC1)
effb51ab
VK
295
296
5ac3236b
VK
297//
298// Global user rights
299//
300
301#define SYSTEM_ACCESS_MANAGE_USERS 0x0001
11363a86
VK
302#define SYSTEM_ACCESS_SERVER_CONFIG 0x0002
303#define SYSTEM_ACCESS_CONFIGURE_TRAPS 0x0004
5ac3236b
VK
304#define SYSTEM_ACCESS_DROP_CONNECTIONS 0x0008
305#define SYSTEM_ACCESS_VIEW_EVENT_DB 0x0010
306#define SYSTEM_ACCESS_EDIT_EVENT_DB 0x0020
a7d07192 307#define SYSTEM_ACCESS_EPP 0x0040
4ae6b70e 308#define SYSTEM_ACCESS_MANAGE_ACTIONS 0x0080
d096bcdd 309#define SYSTEM_ACCESS_DELETE_ALARMS 0x0100
1c8b8363 310#define SYSTEM_ACCESS_MANAGE_PACKAGES 0x0200
5ac3236b 311
4f269e0a 312#define SYSTEM_ACCESS_FULL 0x03FF
911dbb64 313
5ac3236b
VK
314
315//
316// Object access rights
317//
318
319#define OBJECT_ACCESS_READ 0x00000001
320#define OBJECT_ACCESS_MODIFY 0x00000002
321#define OBJECT_ACCESS_CREATE 0x00000004
322#define OBJECT_ACCESS_DELETE 0x00000008
03482383 323#define OBJECT_ACCESS_READ_ALARMS 0x00000010
34d95c13 324#define OBJECT_ACCESS_CONTROL 0x00000020
03482383 325#define OBJECT_ACCESS_ACK_ALARMS 0x00000040
b562fca8 326#define OBJECT_ACCESS_SEND_EVENTS 0x00000080
5ac3236b
VK
327
328
329//
330// User/group flags
331//
332
333#define UF_MODIFIED 0x0001
334#define UF_DELETED 0x0002
335#define UF_DISABLED 0x0004
336#define UF_CHANGE_PASSWORD 0x0008
8c18110a 337#define UF_CANNOT_CHANGE_PASSWORD 0x0010
5ac3236b
VK
338
339
984542f8
VK
340//
341// User database change notification types
342//
343
344#define USER_DB_CREATE 0
345#define USER_DB_DELETE 1
346#define USER_DB_MODIFY 2
347
348
54481027 349//
7ec6cca8 350// Data sources
54481027
VK
351//
352
7ec6cca8
VK
353#define DS_INTERNAL 0
354#define DS_NATIVE_AGENT 1
355#define DS_SNMP_AGENT 2
54481027
VK
356
357
878c92bc 358//
7ec6cca8 359// Item status
878c92bc
VK
360//
361
7ec6cca8
VK
362#define ITEM_STATUS_ACTIVE 0
363#define ITEM_STATUS_DISABLED 1
364#define ITEM_STATUS_NOT_SUPPORTED 2
878c92bc
VK
365
366
333ece94
VK
367//
368// Delta calculation methods for DCIs
369//
370
371#define DCM_ORIGINAL_VALUE 0
372#define DCM_SIMPLE 1
373#define DCM_AVERAGE_PER_SECOND 2
374#define DCM_AVERAGE_PER_MINUTE 3
375
376
d0e94572
VK
377//
378// Threshold functions and operations
379//
380
381#define F_LAST 0
382#define F_AVERAGE 1
383#define F_DEVIATION 2
384
385#define OP_LE 0
386#define OP_LE_EQ 1
387#define OP_EQ 2
388#define OP_GT_EQ 3
389#define OP_GT 4
390#define OP_NE 5
391#define OP_LIKE 6
392#define OP_NOTLIKE 7
393
394
99180ed6
VK
395//
396// Event policy rule flags
397//
398
399#define RF_STOP_PROCESSING 0x0001
400#define RF_NEGATED_SOURCE 0x0002
401#define RF_NEGATED_EVENTS 0x0004
402#define RF_GENERATE_ALARM 0x0008
97e55bb4 403#define RF_DISABLED 0x0010
99180ed6 404#define RF_SEVERITY_INFO 0x0100
2fa43626
VK
405#define RF_SEVERITY_WARNING 0x0200
406#define RF_SEVERITY_MINOR 0x0400
99180ed6
VK
407#define RF_SEVERITY_MAJOR 0x0800
408#define RF_SEVERITY_CRITICAL 0x1000
409
410
4ae6b70e
VK
411//
412// Action types
413//
414
c7863da1
VK
415#define ACTION_EXEC 0
416#define ACTION_REMOTE 1
4ae6b70e 417#define ACTION_SEND_EMAIL 2
c7863da1 418#define ACTION_SEND_SMS 3
4ae6b70e
VK
419
420
125c0e81
VK
421//
422// Agent's parameter information
423//
424
425typedef struct
426{
427 TCHAR szName[MAX_PARAM_NAME];
428 TCHAR szDescription[MAX_DB_STRING];
429 int iDataType;
430} NXC_AGENT_PARAM;
431
432
4ae6b70e
VK
433//
434// Action structure
435//
436
437typedef struct
438{
439 DWORD dwId;
440 int iType;
c9363772 441 BOOL bIsDisabled;
b900a78b
VK
442 TCHAR szName[MAX_OBJECT_NAME];
443 TCHAR szRcptAddr[MAX_RCPT_ADDR_LEN];
444 TCHAR szEmailSubject[MAX_EMAIL_SUBJECT_LEN];
445 TCHAR *pszData;
4ae6b70e 446} NXC_ACTION;
333ece94
VK
447
448
2260ffe5
VK
449//
450// Alarm structure
451//
452
453typedef struct
454{
455 DWORD dwAlarmId; // Unique alarm ID
456 DWORD dwTimeStamp; // Timestamp in time() format
457 DWORD dwSourceObject; // Source object ID
c19b2871
VK
458 DWORD dwSourceEventCode;// Originating event code
459 QWORD qwSourceEventId; // Originating event ID
b40371d4
AK
460 TCHAR szMessage[MAX_DB_STRING];
461 TCHAR szKey[MAX_DB_STRING];
2260ffe5
VK
462 WORD wSeverity; // Alarm's severity
463 WORD wIsAck; // Non-zero if acknowleged
464 DWORD dwAckByUser; // Id of user who acknowleges this alarm (0 for system)
465} NXC_ALARM;
466
467
a1dc75b0
VK
468//
469// Event log record structure
470//
471
472typedef struct
473{
0c6014e4 474 QWORD qwEventId;
a1dc75b0 475 DWORD dwTimeStamp;
0c6014e4 476 DWORD dwEventCode;
a1dc75b0
VK
477 DWORD dwSourceId;
478 DWORD dwSeverity;
babb8280
VK
479#ifdef UNICODE
480 WCHAR szMessage[MAX_EVENT_MSG_LENGTH];
481#else
482 char szMessage[MAX_EVENT_MSG_LENGTH * sizeof(WCHAR)];
483#endif
a1dc75b0
VK
484} NXC_EVENT;
485
486
e641b7d0
VK
487//
488// Image information
489//
490
491typedef struct
492{
493 DWORD dwId;
b900a78b 494 TCHAR szName[MAX_OBJECT_NAME];
e641b7d0
VK
495 BYTE hash[MD5_DIGEST_SIZE];
496} NXC_IMAGE;
497
498
499//
500// Image list
501//
502
503typedef struct
504{
505 DWORD dwNumImages;
506 NXC_IMAGE *pImageList;
507} NXC_IMAGE_LIST;
508
509
840eb902
VK
510//
511// Trap parameter mapping entry
512//
513
565f6f86 514struct NXC_OID_MAP
840eb902
VK
515{
516 DWORD *pdwObjectId; // Trap OID
517 DWORD dwOidLen; // Trap OID length
565f6f86 518 TCHAR szDescription[MAX_DB_STRING];
840eb902
VK
519};
520
521
522//
523// Trap configuration entry
524//
525
526struct NXC_TRAP_CFG_ENTRY
527{
528 DWORD dwId; // Entry ID
529 DWORD *pdwObjectId; // Trap OID
530 DWORD dwOidLen; // Trap OID length
c19b2871 531 DWORD dwEventCode; // Event code
840eb902 532 DWORD dwNumMaps; // Number of parameter mappings
565f6f86
VK
533 NXC_OID_MAP *pMaps;
534 TCHAR szDescription[MAX_DB_STRING];
840eb902
VK
535};
536
537
7ec6cca8
VK
538/********************************************************************
539 * Following part of this file shouldn't be included by server code *
540 ********************************************************************/
541
542#ifndef LIBNXCL_NO_DECLARATIONS
543
544
545//
546// Callbacks data types
547//
548
41213c24 549typedef void (* NXC_EVENT_HANDLER)(NXC_SESSION hSession, DWORD dwEvent, DWORD dwCode, void *pArg);
b40371d4 550typedef void (* NXC_DEBUG_CALLBACK)(TCHAR *pMsg);
7ec6cca8
VK
551
552
1c8b8363
VK
553//
554// Agent package information
555//
556
557typedef struct
558{
559 DWORD dwId;
257defd7 560 TCHAR szName[MAX_PACKAGE_NAME_LEN];
1c8b8363
VK
561 TCHAR szVersion[MAX_AGENT_VERSION_LEN];
562 TCHAR szPlatform[MAX_PLATFORM_NAME_LEN];
563 TCHAR szFileName[MAX_DB_STRING];
257defd7 564 TCHAR szDescription[MAX_DB_STRING];
1c8b8363
VK
565} NXC_PACKAGE_INFO;
566
567
7ec6cca8
VK
568//
569// Event configuration structure
570//
571
572typedef struct
573{
574 DWORD dwCode;
575 DWORD dwSeverity;
576 DWORD dwFlags;
b900a78b
VK
577 TCHAR szName[MAX_EVENT_NAME];
578 TCHAR *pszMessage;
579 TCHAR *pszDescription;
7ec6cca8
VK
580} NXC_EVENT_TEMPLATE;
581
582
effb51ab
VK
583//
584// Entry in object's ACL
585//
586
587typedef struct
588{
589 DWORD dwUserId;
590 DWORD dwAccessRights;
591} NXC_ACL_ENTRY;
592
593
0c8bf759
VK
594//
595// Network object structure
596//
597
598typedef struct
599{
600 DWORD dwId; // Unique object's identifier
601 int iClass; // Object's class
602 int iStatus; // Object's status
603 DWORD dwIpAddr; // IP address
b900a78b 604 TCHAR szName[MAX_OBJECT_NAME];
0c8bf759
VK
605 DWORD dwNumParents;
606 DWORD *pdwParentList;
607 DWORD dwNumChilds;
608 DWORD *pdwChildList;
4d597931 609 BOOL bIsDeleted; // TRUE for deleted objects
effb51ab
VK
610 BOOL bInheritRights;
611 DWORD dwAclSize;
612 NXC_ACL_ENTRY *pAccessList;
03ea8b3d 613 DWORD dwImage; // Image ID or IMG_DEFAULT for default image
0c8bf759
VK
614 union
615 {
616 struct
617 {
618 DWORD dwIpNetMask; // Ip netmask.
619 DWORD dwIfIndex; // Interface index.
620 DWORD dwIfType; // Interface type
b50f1100 621 BYTE bMacAddr[MAC_ADDR_LENGTH];
0c8bf759
VK
622 } iface;
623 struct
624 {
625 DWORD dwFlags;
626 DWORD dwDiscoveryFlags;
18e26ff8 627 DWORD dwNodeType;
89ced6da 628 DWORD dwPollerNode;
b900a78b
VK
629 TCHAR szSharedSecret[MAX_SECRET_LENGTH];
630 TCHAR szCommunityString[MAX_COMMUNITY_LENGTH];
631 TCHAR szObjectId[MAX_OID_LENGTH];
0c8bf759
VK
632 WORD wAgentPort; // Listening TCP port for native agent
633 WORD wAuthMethod; // Native agent's authentication method
70573ffe 634 TCHAR *pszDescription;
d096bcdd 635 TCHAR szAgentVersion[MAX_AGENT_VERSION_LEN];
1c8b8363 636 TCHAR szPlatformName[MAX_PLATFORM_NAME_LEN];
37c4d6aa 637 WORD wSNMPVersion;
0c8bf759
VK
638 } node;
639 struct
640 {
641 DWORD dwIpNetMask;
642 } subnet;
ef44d5ea
VK
643 struct
644 {
645 DWORD dwCategory;
b900a78b 646 TCHAR *pszDescription;
ef44d5ea 647 } container;
70573ffe
VK
648 struct
649 {
650 DWORD dwVersion;
651 TCHAR *pszDescription;
652 } dct;
d780a7bc
VK
653 struct
654 {
655 int iServiceType;
656 WORD wProto;
657 WORD wPort;
658 DWORD dwPollerNode;
659 TCHAR *pszRequest;
660 TCHAR *pszResponce;
661 } netsrv;
0c8bf759
VK
662 };
663} NXC_OBJECT;
664
665
effb51ab
VK
666//
667// Structure with data for NXCModifyObject
668//
669
670typedef struct
671{
672 DWORD dwObjectId;
673 DWORD dwFlags;
b900a78b 674 TCHAR *pszName;
70573ffe 675 TCHAR *pszDescription;
effb51ab
VK
676 int iAgentPort;
677 int iAuthType;
b900a78b 678 TCHAR *pszSecret;
b900a78b 679 TCHAR *pszCommunity;
effb51ab 680 BOOL bInheritRights;
2a41a4b5 681 DWORD dwImage;
effb51ab
VK
682 DWORD dwAclSize;
683 NXC_ACL_ENTRY *pAccessList;
37c4d6aa 684 WORD wSNMPVersion;
d780a7bc
VK
685 int iServiceType;
686 WORD wProto;
687 WORD wPort;
688 DWORD dwPollerNode;
689 TCHAR *pszRequest;
690 TCHAR *pszResponce;
89ced6da 691 DWORD dwIpAddr;
effb51ab
VK
692} NXC_OBJECT_UPDATE;
693
694
5ac3236b
VK
695//
696// NetXMS user information structure
697//
698
699typedef struct
700{
b900a78b 701 TCHAR szName[MAX_USER_NAME];
5ac3236b
VK
702 DWORD dwId;
703 WORD wFlags;
704 WORD wSystemRights;
705 DWORD dwNumMembers; // Only for groups
706 DWORD *pdwMemberList; // Only for groups
b900a78b
VK
707 TCHAR szFullName[MAX_USER_FULLNAME]; // Only for users
708 TCHAR szDescription[MAX_USER_DESCR];
5ac3236b
VK
709} NXC_USER;
710
711
f86ffdd2
VK
712//
713// Data collection item threshold structure
714//
715
716typedef struct
717{
718 DWORD dwId;
719 DWORD dwEvent;
720 WORD wFunction;
721 WORD wOperation;
722 DWORD dwArg1;
723 DWORD dwArg2;
724 union
725 {
726 DWORD dwInt32;
727 INT64 qwInt64;
728 double dFloat;
b40371d4 729 TCHAR szString[MAX_STRING_VALUE];
f86ffdd2
VK
730 } value;
731} NXC_DCI_THRESHOLD;
732
733
7ec6cca8
VK
734//
735// Data collection item structure
736//
737
738typedef struct
739{
740 DWORD dwId;
333ece94 741 DWORD dwTemplateId;
b40371d4
AK
742 TCHAR szName[MAX_ITEM_NAME];
743 TCHAR szDescription[MAX_DB_STRING];
22c38feb 744 TCHAR szInstance[MAX_DB_STRING];
7ec6cca8
VK
745 int iPollingInterval;
746 int iRetentionTime;
747 BYTE iSource;
748 BYTE iDataType;
749 BYTE iStatus;
333ece94 750 BYTE iDeltaCalculation;
f86ffdd2
VK
751 DWORD dwNumThresholds;
752 NXC_DCI_THRESHOLD *pThresholdList;
b40371d4 753 TCHAR *pszFormula;
7ec6cca8
VK
754} NXC_DCI;
755
756
757//
758// Node's data collection list information
759//
760
761typedef struct
762{
763 DWORD dwNodeId;
764 DWORD dwNumItems;
765 NXC_DCI *pItems;
766} NXC_DCI_LIST;
767
768
b9b4ec17
VK
769//
770// Row structure
771//
772
9f20696e
VK
773#pragma pack(1)
774
b9b4ec17
VK
775typedef struct
776{
777 DWORD dwTimeStamp;
778 union
779 {
780 DWORD dwInt32;
cb17745c 781 INT64 qwInt64;
b9b4ec17 782 double dFloat;
b40371d4 783 TCHAR szString[MAX_STRING_VALUE];
b9b4ec17
VK
784 } value;
785} NXC_DCI_ROW;
786
9f20696e
VK
787#pragma pack()
788
b9b4ec17
VK
789
790//
791// DCI's collected data
792//
793
794typedef struct
795{
796 DWORD dwNodeId; // Owner's node id
797 DWORD dwItemId; // Item id
798 DWORD dwNumRows; // Number of rows in set
799 WORD wDataType; // Data type (integer, string, etc.)
800 WORD wRowSize; // Size of single row in bytes
801 NXC_DCI_ROW *pRows; // Array of rows
802} NXC_DCI_DATA;
803
804
a7d07192
VK
805//
806// MIB file list
807//
808
809typedef struct
810{
811 DWORD dwNumFiles;
b40371d4 812 TCHAR **ppszName;
a7d07192
VK
813 BYTE **ppHash;
814} NXC_MIB_LIST;
815
816
817//
818// Event processing policy rule
819//
820
821typedef struct
822{
823 DWORD dwFlags;
824 DWORD dwId;
825 DWORD dwNumActions;
826 DWORD dwNumEvents;
827 DWORD dwNumSources;
828 DWORD *pdwActionList;
829 DWORD *pdwEventList;
830 DWORD *pdwSourceList;
b40371d4
AK
831 TCHAR *pszComment;
832 TCHAR szAlarmKey[MAX_DB_STRING];
833 TCHAR szAlarmAckKey[MAX_DB_STRING];
834 TCHAR szAlarmMessage[MAX_DB_STRING];
a7d07192
VK
835 WORD wAlarmSeverity;
836} NXC_EPP_RULE;
837
838
839//
840// Event processing policy
841//
842
843typedef struct
844{
845 DWORD dwNumRules;
846 NXC_EPP_RULE *pRuleList;
847} NXC_EPP;
848
849
917aa2e6
VK
850//
851// Object creation information structure
852//
853
854typedef struct
855{
856 int iClass;
857 DWORD dwParentId;
b40371d4 858 TCHAR *pszName;
917aa2e6
VK
859 union
860 {
861 struct
862 {
863 DWORD dwIpAddr;
864 DWORD dwNetMask;
865 } node;
866 struct
867 {
868 DWORD dwCategory;
b40371d4 869 TCHAR *pszDescription;
917aa2e6 870 } container;
62d11997
VK
871 struct
872 {
873 TCHAR *pszDescription;
874 } templateGroup;
b61fe31e
VK
875 struct
876 {
877 int iServiceType;
878 WORD wProto;
879 WORD wPort;
880 TCHAR *pszRequest;
881 TCHAR *pszResponce;
882 } netsrv;
917aa2e6
VK
883 } cs;
884} NXC_OBJECT_CREATE_INFO;
885
886
6849d9be
VK
887//
888// Container category
889//
890
891typedef struct
892{
893 DWORD dwId;
894 DWORD dwImageId;
b40371d4
AK
895 TCHAR szName[MAX_OBJECT_NAME];
896 TCHAR *pszDescription;
6849d9be
VK
897} NXC_CONTAINER_CATEGORY;
898
899
900//
901// Container categories list
902//
903
904typedef struct
905{
906 DWORD dwNumElements;
907 NXC_CONTAINER_CATEGORY *pElements;
908} NXC_CC_LIST;
909
910
80ffed5a
VK
911//
912// Functions
913//
914
915#ifdef __cplusplus
916extern "C" {
917#endif
918
8aeffdee 919DWORD LIBNXCL_EXPORTABLE NXCGetVersion(void);
b40371d4 920const TCHAR LIBNXCL_EXPORTABLE *NXCGetErrorText(DWORD dwError);
effb51ab 921
8aeffdee 922BOOL LIBNXCL_EXPORTABLE NXCInitialize(void);
39d7a7ed 923void LIBNXCL_EXPORTABLE NXCShutdown(void);
44342f7b 924void LIBNXCL_EXPORTABLE NXCSetDebugCallback(NXC_DEBUG_CALLBACK pFunc);
41213c24
VK
925
926DWORD LIBNXCL_EXPORTABLE NXCConnect(TCHAR *szServer, TCHAR *szLogin,
927 TCHAR *szPassword, NXC_SESSION *phSession);
928void LIBNXCL_EXPORTABLE NXCDisconnect(NXC_SESSION hSession);
929void LIBNXCL_EXPORTABLE NXCSetEventHandler(NXC_SESSION hSession, NXC_EVENT_HANDLER pHandler);
41213c24
VK
930void LIBNXCL_EXPORTABLE NXCSetCommandTimeout(NXC_SESSION hSession, DWORD dwTimeout);
931
932DWORD LIBNXCL_EXPORTABLE NXCSyncObjects(NXC_SESSION hSession);
933NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectById(NXC_SESSION hSession, DWORD dwId);
934NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectByName(NXC_SESSION hSession, TCHAR *pszName);
935void LIBNXCL_EXPORTABLE NXCEnumerateObjects(NXC_SESSION hSession, BOOL (* pHandler)(NXC_OBJECT *));
936NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetTopologyRootObject(NXC_SESSION hSession);
937NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetServiceRootObject(NXC_SESSION hSession);
938NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetTemplateRootObject(NXC_SESSION hSession);
939void LIBNXCL_EXPORTABLE *NXCGetObjectIndex(NXC_SESSION hSession, DWORD *pdwNumObjects);
940void LIBNXCL_EXPORTABLE NXCLockObjectIndex(NXC_SESSION hSession);
941void LIBNXCL_EXPORTABLE NXCUnlockObjectIndex(NXC_SESSION hSession);
942DWORD LIBNXCL_EXPORTABLE NXCModifyObject(NXC_SESSION hSession, NXC_OBJECT_UPDATE *pData);
943DWORD LIBNXCL_EXPORTABLE NXCSetObjectMgmtStatus(NXC_SESSION hSession, DWORD dwObjectId, BOOL bIsManaged);
944DWORD LIBNXCL_EXPORTABLE NXCCreateObject(NXC_SESSION hSession, NXC_OBJECT_CREATE_INFO *pCreateInfo, DWORD *pdwObjectId);
945DWORD LIBNXCL_EXPORTABLE NXCBindObject(NXC_SESSION hSession, DWORD dwParentObject, DWORD dwChildObject);
946DWORD LIBNXCL_EXPORTABLE NXCUnbindObject(NXC_SESSION hSession, DWORD dwParentObject, DWORD dwChildObject);
947DWORD LIBNXCL_EXPORTABLE NXCDeleteObject(NXC_SESSION hSession, DWORD dwObject);
948DWORD LIBNXCL_EXPORTABLE NXCPollNode(NXC_SESSION hSession, DWORD dwObjectId, int iPollType,
eb8b1960 949 void (* pCallback)(TCHAR *, void *), void *pArg);
41213c24 950DWORD LIBNXCL_EXPORTABLE NXCWakeUpNode(NXC_SESSION hSession, DWORD dwObjectId);
e6ccf59b
VK
951DWORD LIBNXCL_EXPORTABLE NXCGetSupportedParameters(NXC_SESSION hSession, DWORD dwNodeId,
952 DWORD *pdwNumParams,
953 NXC_AGENT_PARAM **ppParamList);
41213c24
VK
954
955DWORD LIBNXCL_EXPORTABLE NXCLoadCCList(NXC_SESSION hSession, NXC_CC_LIST **ppList);
babb8280 956void LIBNXCL_EXPORTABLE NXCDestroyCCList(NXC_CC_LIST *pList);
41213c24
VK
957
958DWORD LIBNXCL_EXPORTABLE NXCSyncEvents(NXC_SESSION hSession);
959DWORD LIBNXCL_EXPORTABLE NXCLoadEventDB(NXC_SESSION hSession);
960DWORD LIBNXCL_EXPORTABLE NXCSetEventInfo(NXC_SESSION hSession, NXC_EVENT_TEMPLATE *pArg);
961DWORD LIBNXCL_EXPORTABLE NXCGenerateEventCode(NXC_SESSION hSession, DWORD *pdwEventCode);
962void LIBNXCL_EXPORTABLE NXCAddEventTemplate(NXC_SESSION hSession, NXC_EVENT_TEMPLATE *pEventTemplate);
963void LIBNXCL_EXPORTABLE NXCDeleteEDBRecord(NXC_SESSION hSession, DWORD dwEventCode);
964DWORD LIBNXCL_EXPORTABLE NXCDeleteEventTemplate(NXC_SESSION hSession, DWORD dwEventCode);
965DWORD LIBNXCL_EXPORTABLE NXCLockEventDB(NXC_SESSION hSession);
966DWORD LIBNXCL_EXPORTABLE NXCUnlockEventDB(NXC_SESSION hSession);
967BOOL LIBNXCL_EXPORTABLE NXCGetEventDB(NXC_SESSION hSession, NXC_EVENT_TEMPLATE ***pppTemplateList, DWORD *pdwNumRecords);
968const TCHAR LIBNXCL_EXPORTABLE *NXCGetEventName(NXC_SESSION hSession, DWORD dwId);
969BOOL LIBNXCL_EXPORTABLE NXCGetEventNameEx(NXC_SESSION hSession, DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize);
970int LIBNXCL_EXPORTABLE NXCGetEventSeverity(NXC_SESSION hSession, DWORD dwId);
971BOOL LIBNXCL_EXPORTABLE NXCGetEventText(NXC_SESSION hSession, DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize);
972DWORD LIBNXCL_EXPORTABLE NXCSendEvent(NXC_SESSION hSession, DWORD dwEventCode, DWORD dwObjectId, int iNumArgs, TCHAR **pArgList);
973
974DWORD LIBNXCL_EXPORTABLE NXCLoadUserDB(NXC_SESSION hSession);
975NXC_USER LIBNXCL_EXPORTABLE *NXCFindUserById(NXC_SESSION hSession, DWORD dwId);
976BOOL LIBNXCL_EXPORTABLE NXCGetUserDB(NXC_SESSION hSession, NXC_USER **ppUserList, DWORD *pdwNumUsers);
977DWORD LIBNXCL_EXPORTABLE NXCLockUserDB(NXC_SESSION hSession);
978DWORD LIBNXCL_EXPORTABLE NXCUnlockUserDB(NXC_SESSION hSession);
979DWORD LIBNXCL_EXPORTABLE NXCCreateUser(NXC_SESSION hSession, TCHAR *pszName, BOOL bIsGroup, DWORD *pdwNewId);
980DWORD LIBNXCL_EXPORTABLE NXCDeleteUser(NXC_SESSION hSession, DWORD dwId);
981DWORD LIBNXCL_EXPORTABLE NXCModifyUser(NXC_SESSION hSession, NXC_USER *pUserInfo);
982DWORD LIBNXCL_EXPORTABLE NXCSetPassword(NXC_SESSION hSession, DWORD dwUserId, TCHAR *pszNewPassword);
983
984DWORD LIBNXCL_EXPORTABLE NXCOpenNodeDCIList(NXC_SESSION hSession, DWORD dwNodeId, NXC_DCI_LIST **ppItemList);
985DWORD LIBNXCL_EXPORTABLE NXCCloseNodeDCIList(NXC_SESSION hSession, NXC_DCI_LIST *pItemList);
986DWORD LIBNXCL_EXPORTABLE NXCCreateNewDCI(NXC_SESSION hSession, NXC_DCI_LIST *pItemList, DWORD *pdwItemId);
987DWORD LIBNXCL_EXPORTABLE NXCUpdateDCI(NXC_SESSION hSession, DWORD dwNodeId, NXC_DCI *pItem);
988DWORD LIBNXCL_EXPORTABLE NXCDeleteDCI(NXC_SESSION hSession, NXC_DCI_LIST *pItemList, DWORD dwItemId);
989DWORD LIBNXCL_EXPORTABLE NXCSetDCIStatus(NXC_SESSION hSession, DWORD dwNodeId, DWORD dwNumItems,
2185f431 990 DWORD *pdwItemList, int iStatus);
41213c24 991DWORD LIBNXCL_EXPORTABLE NXCCopyDCI(NXC_SESSION hSession, DWORD dwSrcNodeId, DWORD dwDstNodeId,
933aee5c 992 DWORD dwNumItems, DWORD *pdwItemList);
7ac0c0a8 993DWORD LIBNXCL_EXPORTABLE NXCItemIndex(NXC_DCI_LIST *pItemList, DWORD dwItemId);
41213c24 994DWORD LIBNXCL_EXPORTABLE NXCGetDCIData(NXC_SESSION hSession, DWORD dwNodeId, DWORD dwItemId, DWORD dwMaxRows,
b9b4ec17 995 DWORD dwTimeFrom, DWORD dwTimeTo, NXC_DCI_DATA **ppData);
4c20673b
VK
996void LIBNXCL_EXPORTABLE NXCDestroyDCIData(NXC_DCI_DATA *pData);
997NXC_DCI_ROW LIBNXCL_EXPORTABLE *NXCGetRowPtr(NXC_DCI_DATA *pData, DWORD dwRow);
899f2093
VK
998DWORD LIBNXCL_EXPORTABLE NXCAddThresholdToItem(NXC_DCI *pItem, NXC_DCI_THRESHOLD *pThreshold);
999BOOL LIBNXCL_EXPORTABLE NXCDeleteThresholdFromItem(NXC_DCI *pItem, DWORD dwIndex);
1000BOOL LIBNXCL_EXPORTABLE NXCSwapThresholds(NXC_DCI *pItem, DWORD dwIndex1, DWORD dwIndex2);
41213c24 1001DWORD LIBNXCL_EXPORTABLE NXCQueryParameter(NXC_SESSION hSession, DWORD dwNodeId, int iOrigin, TCHAR *pszParameter,
2e0596dd 1002 TCHAR *pszBuffer, DWORD dwBufferSize);
7ec6cca8 1003
41213c24 1004DWORD LIBNXCL_EXPORTABLE NXCGetMIBList(NXC_SESSION hSession, NXC_MIB_LIST **ppMibList);
a7d07192 1005void LIBNXCL_EXPORTABLE NXCDestroyMIBList(NXC_MIB_LIST *pMibList);
41213c24 1006DWORD LIBNXCL_EXPORTABLE NXCDownloadMIBFile(NXC_SESSION hSession, TCHAR *pszName, TCHAR *pszDestDir);
a7d07192 1007
41213c24
VK
1008DWORD LIBNXCL_EXPORTABLE NXCOpenEventPolicy(NXC_SESSION hSession, NXC_EPP **ppEventPolicy);
1009DWORD LIBNXCL_EXPORTABLE NXCCloseEventPolicy(NXC_SESSION hSession);
1010DWORD LIBNXCL_EXPORTABLE NXCSaveEventPolicy(NXC_SESSION hSession, NXC_EPP *pEventPolicy);
a7d07192 1011void LIBNXCL_EXPORTABLE NXCDestroyEventPolicy(NXC_EPP *pEventPolicy);
ef44d5ea 1012void LIBNXCL_EXPORTABLE NXCDeletePolicyRule(NXC_EPP *pEventPolicy, DWORD dwRule);
a7d07192 1013
41213c24
VK
1014DWORD LIBNXCL_EXPORTABLE NXCSyncImages(NXC_SESSION hSession, NXC_IMAGE_LIST **ppImageList, TCHAR *pszCacheDir, WORD wFormat);
1015DWORD LIBNXCL_EXPORTABLE NXCLoadImageFile(NXC_SESSION hSession, DWORD dwImageId, TCHAR *pszCacheDir, WORD wFormat);
f70fc197 1016void LIBNXCL_EXPORTABLE NXCDestroyImageList(NXC_IMAGE_LIST *pImageList);
41213c24 1017DWORD LIBNXCL_EXPORTABLE NXCLoadDefaultImageList(NXC_SESSION hSession, DWORD *pdwListSize,
51bd5a10 1018 DWORD **ppdwClassId, DWORD **ppdwImageId);
f70fc197 1019
41213c24
VK
1020DWORD LIBNXCL_EXPORTABLE NXCLoadAllAlarms(NXC_SESSION hSession, BOOL bIncludeAck, DWORD *pdwNumAlarms, NXC_ALARM **ppAlarmList);
1021DWORD LIBNXCL_EXPORTABLE NXCAcknowlegeAlarm(NXC_SESSION hSession, DWORD dwAlarmId);
1022DWORD LIBNXCL_EXPORTABLE NXCDeleteAlarm(NXC_SESSION hSession, DWORD dwAlarmId);
03482383 1023
41213c24
VK
1024DWORD LIBNXCL_EXPORTABLE NXCLoadActions(NXC_SESSION hSession, DWORD *pdwNumActions, NXC_ACTION **ppActionList);
1025DWORD LIBNXCL_EXPORTABLE NXCLockActionDB(NXC_SESSION hSession);
1026DWORD LIBNXCL_EXPORTABLE NXCUnlockActionDB(NXC_SESSION hSession);
1027DWORD LIBNXCL_EXPORTABLE NXCCreateAction(NXC_SESSION hSession, TCHAR *pszName, DWORD *pdwNewId);
1028DWORD LIBNXCL_EXPORTABLE NXCModifyAction(NXC_SESSION hSession, NXC_ACTION *pAction);
1029DWORD LIBNXCL_EXPORTABLE NXCDeleteAction(NXC_SESSION hSession, DWORD dwActionId);
5bfcf934 1030
41213c24
VK
1031DWORD LIBNXCL_EXPORTABLE NXCLockTrapCfg(NXC_SESSION hSession);
1032DWORD LIBNXCL_EXPORTABLE NXCUnlockTrapCfg(NXC_SESSION hSession);
1033DWORD LIBNXCL_EXPORTABLE NXCLoadTrapCfg(NXC_SESSION hSession, DWORD *pdwNumTraps, NXC_TRAP_CFG_ENTRY **ppTrapList);
840eb902 1034void LIBNXCL_EXPORTABLE NXCDestroyTrapList(DWORD dwNumTraps, NXC_TRAP_CFG_ENTRY *pTrapList);
41213c24
VK
1035DWORD LIBNXCL_EXPORTABLE NXCCreateTrap(NXC_SESSION hSession, DWORD *pdwTrapId);
1036DWORD LIBNXCL_EXPORTABLE NXCModifyTrap(NXC_SESSION hSession, NXC_TRAP_CFG_ENTRY *pTrap);
1037DWORD LIBNXCL_EXPORTABLE NXCDeleteTrap(NXC_SESSION hSession, DWORD dwTrapId);
840eb902 1038
5be45ff2
VK
1039DWORD LIBNXCL_EXPORTABLE NXCLockPackageDB(NXC_SESSION hSession);
1040DWORD LIBNXCL_EXPORTABLE NXCUnlockPackageDB(NXC_SESSION hSession);
1c8b8363
VK
1041DWORD LIBNXCL_EXPORTABLE NXCGetPackageList(NXC_SESSION hSession, DWORD *pdwNumPackages,
1042 NXC_PACKAGE_INFO **ppList);
257defd7
VK
1043DWORD LIBNXCL_EXPORTABLE NXCInstallPackage(NXC_SESSION hSession, NXC_PACKAGE_INFO *pInfo,
1044 TCHAR *pszFullPkgPath);
19acf449 1045DWORD LIBNXCL_EXPORTABLE NXCRemovePackage(NXC_SESSION hSession, DWORD dwPkgId);
93e33892 1046DWORD LIBNXCL_EXPORTABLE NXCParseNPIFile(TCHAR *pszInfoFile, NXC_PACKAGE_INFO *pInfo);
1c8b8363 1047
80ffed5a
VK
1048#ifdef __cplusplus
1049}
1050#endif
1051
7ec6cca8
VK
1052#endif /* LIBNXCL_NO_DECLARATIONS */
1053
80ffed5a 1054#endif /* _nxclapi_h_ */