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