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