First version of event sender
[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)
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
249#define OBJ_UPDATE_NAME ((DWORD)0x01)
250#define OBJ_UPDATE_AGENT_PORT ((DWORD)0x02)
251#define OBJ_UPDATE_AGENT_AUTH ((DWORD)0x04)
252#define OBJ_UPDATE_AGENT_SECRET ((DWORD)0x08)
253#define OBJ_UPDATE_SNMP_VERSION ((DWORD)0x10)
254#define OBJ_UPDATE_SNMP_COMMUNITY ((DWORD)0x20)
255#define OBJ_UPDATE_ACL ((DWORD)0x40)
2a41a4b5
VK
256#define OBJ_UPDATE_IMAGE ((DWORD)0x80)
257#define OBJ_UPDATE_ALL ((DWORD)0xFF)
effb51ab
VK
258
259
5ac3236b
VK
260//
261// Global user rights
262//
263
264#define SYSTEM_ACCESS_MANAGE_USERS 0x0001
265#define SYSTEM_ACCESS_VIEW_CONFIG 0x0002
266#define SYSTEM_ACCESS_EDIT_CONFIG 0x0004
267#define SYSTEM_ACCESS_DROP_CONNECTIONS 0x0008
268#define SYSTEM_ACCESS_VIEW_EVENT_DB 0x0010
269#define SYSTEM_ACCESS_EDIT_EVENT_DB 0x0020
a7d07192 270#define SYSTEM_ACCESS_EPP 0x0040
4ae6b70e 271#define SYSTEM_ACCESS_MANAGE_ACTIONS 0x0080
5ac3236b 272
4ae6b70e 273#define SYSTEM_ACCESS_FULL 0x00FF
911dbb64 274
5ac3236b
VK
275
276//
277// Object access rights
278//
279
280#define OBJECT_ACCESS_READ 0x00000001
281#define OBJECT_ACCESS_MODIFY 0x00000002
282#define OBJECT_ACCESS_CREATE 0x00000004
283#define OBJECT_ACCESS_DELETE 0x00000008
03482383 284#define OBJECT_ACCESS_READ_ALARMS 0x00000010
34d95c13 285#define OBJECT_ACCESS_CONTROL 0x00000020
03482383 286#define OBJECT_ACCESS_ACK_ALARMS 0x00000040
5ac3236b
VK
287
288
289//
290// User/group flags
291//
292
293#define UF_MODIFIED 0x0001
294#define UF_DELETED 0x0002
295#define UF_DISABLED 0x0004
296#define UF_CHANGE_PASSWORD 0x0008
8c18110a 297#define UF_CANNOT_CHANGE_PASSWORD 0x0010
5ac3236b
VK
298
299
984542f8
VK
300//
301// User database change notification types
302//
303
304#define USER_DB_CREATE 0
305#define USER_DB_DELETE 1
306#define USER_DB_MODIFY 2
307
308
878c92bc 309//
7ec6cca8 310// Data types
878c92bc
VK
311//
312
0ae741b9
VK
313#define DCI_DT_INT 0
314#define DCI_DT_UINT 1
315#define DCI_DT_INT64 2
316#define DCI_DT_UINT64 3
317#define DCI_DT_STRING 4
318#define DCI_DT_FLOAT 5
b601b1fa
VK
319
320
54481027 321//
7ec6cca8 322// Data sources
54481027
VK
323//
324
7ec6cca8
VK
325#define DS_INTERNAL 0
326#define DS_NATIVE_AGENT 1
327#define DS_SNMP_AGENT 2
54481027
VK
328
329
878c92bc 330//
7ec6cca8 331// Item status
878c92bc
VK
332//
333
7ec6cca8
VK
334#define ITEM_STATUS_ACTIVE 0
335#define ITEM_STATUS_DISABLED 1
336#define ITEM_STATUS_NOT_SUPPORTED 2
878c92bc
VK
337
338
333ece94
VK
339//
340// Delta calculation methods for DCIs
341//
342
343#define DCM_ORIGINAL_VALUE 0
344#define DCM_SIMPLE 1
345#define DCM_AVERAGE_PER_SECOND 2
346#define DCM_AVERAGE_PER_MINUTE 3
347
348
d0e94572
VK
349//
350// Threshold functions and operations
351//
352
353#define F_LAST 0
354#define F_AVERAGE 1
355#define F_DEVIATION 2
356
357#define OP_LE 0
358#define OP_LE_EQ 1
359#define OP_EQ 2
360#define OP_GT_EQ 3
361#define OP_GT 4
362#define OP_NE 5
363#define OP_LIKE 6
364#define OP_NOTLIKE 7
365
366
99180ed6
VK
367//
368// Event policy rule flags
369//
370
371#define RF_STOP_PROCESSING 0x0001
372#define RF_NEGATED_SOURCE 0x0002
373#define RF_NEGATED_EVENTS 0x0004
374#define RF_GENERATE_ALARM 0x0008
97e55bb4 375#define RF_DISABLED 0x0010
99180ed6 376#define RF_SEVERITY_INFO 0x0100
2fa43626
VK
377#define RF_SEVERITY_WARNING 0x0200
378#define RF_SEVERITY_MINOR 0x0400
99180ed6
VK
379#define RF_SEVERITY_MAJOR 0x0800
380#define RF_SEVERITY_CRITICAL 0x1000
381
382
4ae6b70e
VK
383//
384// Action types
385//
386
c7863da1
VK
387#define ACTION_EXEC 0
388#define ACTION_REMOTE 1
4ae6b70e 389#define ACTION_SEND_EMAIL 2
c7863da1 390#define ACTION_SEND_SMS 3
4ae6b70e
VK
391
392
393//
394// Action structure
395//
396
397typedef struct
398{
399 DWORD dwId;
400 int iType;
c9363772 401 BOOL bIsDisabled;
b900a78b
VK
402 TCHAR szName[MAX_OBJECT_NAME];
403 TCHAR szRcptAddr[MAX_RCPT_ADDR_LEN];
404 TCHAR szEmailSubject[MAX_EMAIL_SUBJECT_LEN];
405 TCHAR *pszData;
4ae6b70e 406} NXC_ACTION;
333ece94
VK
407
408
2260ffe5
VK
409//
410// Alarm structure
411//
412
413typedef struct
414{
415 DWORD dwAlarmId; // Unique alarm ID
416 DWORD dwTimeStamp; // Timestamp in time() format
417 DWORD dwSourceObject; // Source object ID
418 DWORD dwSourceEvent; // Originating event ID
b40371d4
AK
419 TCHAR szMessage[MAX_DB_STRING];
420 TCHAR szKey[MAX_DB_STRING];
2260ffe5
VK
421 WORD wSeverity; // Alarm's severity
422 WORD wIsAck; // Non-zero if acknowleged
423 DWORD dwAckByUser; // Id of user who acknowleges this alarm (0 for system)
424} NXC_ALARM;
425
426
a1dc75b0
VK
427//
428// Event log record structure
429//
430
431typedef struct
432{
433 DWORD dwTimeStamp;
434 DWORD dwEventId;
435 DWORD dwSourceId;
436 DWORD dwSeverity;
b900a78b 437 TCHAR szMessage[MAX_EVENT_MSG_LENGTH];
a1dc75b0
VK
438} NXC_EVENT;
439
440
3421c063
VK
441//
442// Event name/code pair
443//
444
445typedef struct
446{
447 DWORD dwEventId;
936eeedf 448 DWORD dwSeverity;
b900a78b 449 TCHAR szName[MAX_EVENT_NAME];
3421c063
VK
450} NXC_EVENT_NAME;
451
452
e641b7d0
VK
453//
454// Image information
455//
456
457typedef struct
458{
459 DWORD dwId;
b900a78b 460 TCHAR szName[MAX_OBJECT_NAME];
e641b7d0
VK
461 BYTE hash[MD5_DIGEST_SIZE];
462} NXC_IMAGE;
463
464
465//
466// Image list
467//
468
469typedef struct
470{
471 DWORD dwNumImages;
472 NXC_IMAGE *pImageList;
473} NXC_IMAGE_LIST;
474
475
7ec6cca8
VK
476/********************************************************************
477 * Following part of this file shouldn't be included by server code *
478 ********************************************************************/
479
480#ifndef LIBNXCL_NO_DECLARATIONS
481
482
483//
484// Callbacks data types
485//
486
487typedef void (* NXC_EVENT_HANDLER)(DWORD dwEvent, DWORD dwCode, void *pArg);
b40371d4 488typedef void (* NXC_DEBUG_CALLBACK)(TCHAR *pMsg);
7ec6cca8
VK
489
490
491//
492// Event configuration structure
493//
494
495typedef struct
496{
497 DWORD dwCode;
498 DWORD dwSeverity;
499 DWORD dwFlags;
b900a78b
VK
500 TCHAR szName[MAX_EVENT_NAME];
501 TCHAR *pszMessage;
502 TCHAR *pszDescription;
7ec6cca8
VK
503} NXC_EVENT_TEMPLATE;
504
505
effb51ab
VK
506//
507// Entry in object's ACL
508//
509
510typedef struct
511{
512 DWORD dwUserId;
513 DWORD dwAccessRights;
514} NXC_ACL_ENTRY;
515
516
0c8bf759
VK
517//
518// Network object structure
519//
520
521typedef struct
522{
523 DWORD dwId; // Unique object's identifier
524 int iClass; // Object's class
525 int iStatus; // Object's status
526 DWORD dwIpAddr; // IP address
b900a78b 527 TCHAR szName[MAX_OBJECT_NAME];
0c8bf759
VK
528 DWORD dwNumParents;
529 DWORD *pdwParentList;
530 DWORD dwNumChilds;
531 DWORD *pdwChildList;
4d597931 532 BOOL bIsDeleted; // TRUE for deleted objects
effb51ab
VK
533 BOOL bInheritRights;
534 DWORD dwAclSize;
535 NXC_ACL_ENTRY *pAccessList;
03ea8b3d 536 DWORD dwImage; // Image ID or IMG_DEFAULT for default image
0c8bf759
VK
537 union
538 {
539 struct
540 {
541 DWORD dwIpNetMask; // Ip netmask.
542 DWORD dwIfIndex; // Interface index.
543 DWORD dwIfType; // Interface type
b50f1100 544 BYTE bMacAddr[MAC_ADDR_LENGTH];
0c8bf759
VK
545 } iface;
546 struct
547 {
548 DWORD dwFlags;
549 DWORD dwDiscoveryFlags;
b900a78b
VK
550 TCHAR szSharedSecret[MAX_SECRET_LENGTH];
551 TCHAR szCommunityString[MAX_COMMUNITY_LENGTH];
552 TCHAR szObjectId[MAX_OID_LENGTH];
0c8bf759
VK
553 WORD wAgentPort; // Listening TCP port for native agent
554 WORD wAuthMethod; // Native agent's authentication method
555 } node;
556 struct
557 {
558 DWORD dwIpNetMask;
559 } subnet;
ef44d5ea
VK
560 struct
561 {
562 DWORD dwCategory;
b900a78b 563 TCHAR *pszDescription;
ef44d5ea 564 } container;
0c8bf759
VK
565 };
566} NXC_OBJECT;
567
568
effb51ab
VK
569//
570// Structure with data for NXCModifyObject
571//
572
573typedef struct
574{
575 DWORD dwObjectId;
576 DWORD dwFlags;
b900a78b 577 TCHAR *pszName;
effb51ab
VK
578 int iAgentPort;
579 int iAuthType;
b900a78b 580 TCHAR *pszSecret;
effb51ab 581 int iSnmpVersion;
b900a78b 582 TCHAR *pszCommunity;
effb51ab 583 BOOL bInheritRights;
2a41a4b5 584 DWORD dwImage;
effb51ab
VK
585 DWORD dwAclSize;
586 NXC_ACL_ENTRY *pAccessList;
587} NXC_OBJECT_UPDATE;
588
589
5ac3236b
VK
590//
591// NetXMS user information structure
592//
593
594typedef struct
595{
b900a78b 596 TCHAR szName[MAX_USER_NAME];
5ac3236b
VK
597 DWORD dwId;
598 WORD wFlags;
599 WORD wSystemRights;
600 DWORD dwNumMembers; // Only for groups
601 DWORD *pdwMemberList; // Only for groups
b900a78b
VK
602 TCHAR szFullName[MAX_USER_FULLNAME]; // Only for users
603 TCHAR szDescription[MAX_USER_DESCR];
5ac3236b
VK
604} NXC_USER;
605
606
f86ffdd2
VK
607//
608// Data collection item threshold structure
609//
610
611typedef struct
612{
613 DWORD dwId;
614 DWORD dwEvent;
615 WORD wFunction;
616 WORD wOperation;
617 DWORD dwArg1;
618 DWORD dwArg2;
619 union
620 {
621 DWORD dwInt32;
622 INT64 qwInt64;
623 double dFloat;
b40371d4 624 TCHAR szString[MAX_STRING_VALUE];
f86ffdd2
VK
625 } value;
626} NXC_DCI_THRESHOLD;
627
628
7ec6cca8
VK
629//
630// Data collection item structure
631//
632
633typedef struct
634{
635 DWORD dwId;
333ece94 636 DWORD dwTemplateId;
b40371d4
AK
637 TCHAR szName[MAX_ITEM_NAME];
638 TCHAR szDescription[MAX_DB_STRING];
7ec6cca8
VK
639 int iPollingInterval;
640 int iRetentionTime;
641 BYTE iSource;
642 BYTE iDataType;
643 BYTE iStatus;
333ece94 644 BYTE iDeltaCalculation;
f86ffdd2
VK
645 DWORD dwNumThresholds;
646 NXC_DCI_THRESHOLD *pThresholdList;
b40371d4 647 TCHAR *pszFormula;
7ec6cca8
VK
648} NXC_DCI;
649
650
651//
652// Node's data collection list information
653//
654
655typedef struct
656{
657 DWORD dwNodeId;
658 DWORD dwNumItems;
659 NXC_DCI *pItems;
660} NXC_DCI_LIST;
661
662
b9b4ec17
VK
663//
664// Row structure
665//
666
9f20696e
VK
667#pragma pack(1)
668
b9b4ec17
VK
669typedef struct
670{
671 DWORD dwTimeStamp;
672 union
673 {
674 DWORD dwInt32;
cb17745c 675 INT64 qwInt64;
b9b4ec17 676 double dFloat;
b40371d4 677 TCHAR szString[MAX_STRING_VALUE];
b9b4ec17
VK
678 } value;
679} NXC_DCI_ROW;
680
9f20696e
VK
681#pragma pack()
682
b9b4ec17
VK
683
684//
685// DCI's collected data
686//
687
688typedef struct
689{
690 DWORD dwNodeId; // Owner's node id
691 DWORD dwItemId; // Item id
692 DWORD dwNumRows; // Number of rows in set
693 WORD wDataType; // Data type (integer, string, etc.)
694 WORD wRowSize; // Size of single row in bytes
695 NXC_DCI_ROW *pRows; // Array of rows
696} NXC_DCI_DATA;
697
698
a7d07192
VK
699//
700// MIB file list
701//
702
703typedef struct
704{
705 DWORD dwNumFiles;
b40371d4 706 TCHAR **ppszName;
a7d07192
VK
707 BYTE **ppHash;
708} NXC_MIB_LIST;
709
710
711//
712// Event processing policy rule
713//
714
715typedef struct
716{
717 DWORD dwFlags;
718 DWORD dwId;
719 DWORD dwNumActions;
720 DWORD dwNumEvents;
721 DWORD dwNumSources;
722 DWORD *pdwActionList;
723 DWORD *pdwEventList;
724 DWORD *pdwSourceList;
b40371d4
AK
725 TCHAR *pszComment;
726 TCHAR szAlarmKey[MAX_DB_STRING];
727 TCHAR szAlarmAckKey[MAX_DB_STRING];
728 TCHAR szAlarmMessage[MAX_DB_STRING];
a7d07192
VK
729 WORD wAlarmSeverity;
730} NXC_EPP_RULE;
731
732
733//
734// Event processing policy
735//
736
737typedef struct
738{
739 DWORD dwNumRules;
740 NXC_EPP_RULE *pRuleList;
741} NXC_EPP;
742
743
917aa2e6
VK
744//
745// Object creation information structure
746//
747
748typedef struct
749{
750 int iClass;
751 DWORD dwParentId;
b40371d4 752 TCHAR *pszName;
917aa2e6
VK
753 union
754 {
755 struct
756 {
757 DWORD dwIpAddr;
758 DWORD dwNetMask;
759 } node;
760 struct
761 {
762 DWORD dwCategory;
b40371d4 763 TCHAR *pszDescription;
917aa2e6 764 } container;
62d11997
VK
765 struct
766 {
767 TCHAR *pszDescription;
768 } templateGroup;
917aa2e6
VK
769 } cs;
770} NXC_OBJECT_CREATE_INFO;
771
772
6849d9be
VK
773//
774// Container category
775//
776
777typedef struct
778{
779 DWORD dwId;
780 DWORD dwImageId;
b40371d4
AK
781 TCHAR szName[MAX_OBJECT_NAME];
782 TCHAR *pszDescription;
6849d9be
VK
783} NXC_CONTAINER_CATEGORY;
784
785
786//
787// Container categories list
788//
789
790typedef struct
791{
792 DWORD dwNumElements;
793 NXC_CONTAINER_CATEGORY *pElements;
794} NXC_CC_LIST;
795
796
80ffed5a
VK
797//
798// Functions
799//
800
801#ifdef __cplusplus
802extern "C" {
803#endif
804
8aeffdee 805DWORD LIBNXCL_EXPORTABLE NXCGetVersion(void);
b40371d4 806const TCHAR LIBNXCL_EXPORTABLE *NXCGetErrorText(DWORD dwError);
effb51ab 807
8aeffdee 808BOOL LIBNXCL_EXPORTABLE NXCInitialize(void);
39d7a7ed
VK
809void LIBNXCL_EXPORTABLE NXCShutdown(void);
810
b40371d4 811DWORD LIBNXCL_EXPORTABLE NXCConnect(TCHAR *szServer, TCHAR *szLogin, TCHAR *szPassword);
8aeffdee
VK
812void LIBNXCL_EXPORTABLE NXCDisconnect(void);
813void LIBNXCL_EXPORTABLE NXCSetEventHandler(NXC_EVENT_HANDLER pHandler);
814void LIBNXCL_EXPORTABLE NXCSetDebugCallback(NXC_DEBUG_CALLBACK pFunc);
815HREQUEST LIBNXCL_EXPORTABLE NXCRequest(DWORD dwOperation, ...);
80ffed5a 816
2e29457d 817DWORD LIBNXCL_EXPORTABLE NXCSyncObjects(void);
8aeffdee 818NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectById(DWORD dwId);
b40371d4 819NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectByName(TCHAR *pszName);
8aeffdee 820void LIBNXCL_EXPORTABLE NXCEnumerateObjects(BOOL (* pHandler)(NXC_OBJECT *));
e6b958c4
VK
821NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetTopologyRootObject(void);
822NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetServiceRootObject(void);
62d11997 823NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetTemplateRootObject(void);
8e80aeb6
VK
824void LIBNXCL_EXPORTABLE *NXCGetObjectIndex(DWORD *pdwNumObjects);
825void LIBNXCL_EXPORTABLE NXCLockObjectIndex(void);
826void LIBNXCL_EXPORTABLE NXCUnlockObjectIndex(void);
2e29457d 827DWORD LIBNXCL_EXPORTABLE NXCModifyObject(NXC_OBJECT_UPDATE *pData);
c1c39152 828DWORD LIBNXCL_EXPORTABLE NXCSetObjectMgmtStatus(DWORD dwObjectId, BOOL bIsManaged);
917aa2e6 829DWORD LIBNXCL_EXPORTABLE NXCCreateObject(NXC_OBJECT_CREATE_INFO *pCreateInfo, DWORD *pdwObjectId);
e6b958c4
VK
830DWORD LIBNXCL_EXPORTABLE NXCBindObject(DWORD dwParentObject, DWORD dwChildObject);
831DWORD LIBNXCL_EXPORTABLE NXCUnbindObject(DWORD dwParentObject, DWORD dwChildObject);
88039e6c 832DWORD LIBNXCL_EXPORTABLE NXCDeleteObject(DWORD dwObject);
eb8b1960
VK
833DWORD LIBNXCL_EXPORTABLE NXCPollNode(DWORD dwObjectId, int iPollType,
834 void (* pCallback)(TCHAR *, void *), void *pArg);
8b3d61c1 835
6849d9be
VK
836DWORD LIBNXCL_EXPORTABLE NXCLoadCCList(NXC_CC_LIST **ppList);
837void LIBNXCL_EXPORTABLE NXCDestroyCCList(NXC_CC_LIST *pList);
838
2e29457d
VK
839DWORD LIBNXCL_EXPORTABLE NXCSyncEvents(void);
840DWORD LIBNXCL_EXPORTABLE NXCOpenEventDB(void);
841DWORD LIBNXCL_EXPORTABLE NXCCloseEventDB(BOOL bSaveChanges);
8aeffdee
VK
842BOOL LIBNXCL_EXPORTABLE NXCGetEventDB(NXC_EVENT_TEMPLATE ***pppTemplateList, DWORD *pdwNumRecords);
843void LIBNXCL_EXPORTABLE NXCModifyEventTemplate(NXC_EVENT_TEMPLATE *pEvent, DWORD dwMask,
b40371d4
AK
844 DWORD dwSeverity, DWORD dwFlags, const TCHAR *pszName,
845 const TCHAR *pszMessage, const TCHAR *pszDescription);
3421c063
VK
846DWORD LIBNXCL_EXPORTABLE NXCLoadEventNames(void);
847NXC_EVENT_NAME LIBNXCL_EXPORTABLE *NXCGetEventNamesList(DWORD *pdwNumEvents);
b40371d4 848const TCHAR LIBNXCL_EXPORTABLE *NXCGetEventName(DWORD dwId);
2fa43626 849int LIBNXCL_EXPORTABLE NXCGetEventSeverity(DWORD dwId);
f6eade3f 850DWORD LIBNXCL_EXPORTABLE NXCSendEvent(DWORD dwEventCode, int iNumArgs, TCHAR **pArgList);
878c92bc 851
2e29457d 852DWORD LIBNXCL_EXPORTABLE NXCLoadUserDB(void);
5ac3236b 853NXC_USER LIBNXCL_EXPORTABLE *NXCFindUserById(DWORD dwId);
440716ce 854BOOL LIBNXCL_EXPORTABLE NXCGetUserDB(NXC_USER **ppUserList, DWORD *pdwNumUsers);
0d9c1b96
VK
855DWORD LIBNXCL_EXPORTABLE NXCLockUserDB(void);
856DWORD LIBNXCL_EXPORTABLE NXCUnlockUserDB(void);
b40371d4 857DWORD LIBNXCL_EXPORTABLE NXCCreateUser(TCHAR *pszName, BOOL bIsGroup, DWORD *pdwNewId);
f75b99fd 858DWORD LIBNXCL_EXPORTABLE NXCDeleteUser(DWORD dwId);
911dbb64 859DWORD LIBNXCL_EXPORTABLE NXCModifyUser(NXC_USER *pUserInfo);
b40371d4 860DWORD LIBNXCL_EXPORTABLE NXCSetPassword(DWORD dwUserId, TCHAR *pszNewPassword);
5ac3236b 861
7ec6cca8
VK
862DWORD LIBNXCL_EXPORTABLE NXCOpenNodeDCIList(DWORD dwNodeId, NXC_DCI_LIST **ppItemList);
863DWORD LIBNXCL_EXPORTABLE NXCCloseNodeDCIList(NXC_DCI_LIST *pItemList);
7ac0c0a8
VK
864DWORD LIBNXCL_EXPORTABLE NXCCreateNewDCI(NXC_DCI_LIST *pItemList, DWORD *pdwItemId);
865DWORD LIBNXCL_EXPORTABLE NXCUpdateDCI(DWORD dwNodeId, NXC_DCI *pItem);
866DWORD LIBNXCL_EXPORTABLE NXCDeleteDCI(NXC_DCI_LIST *pItemList, DWORD dwItemId);
933aee5c
VK
867DWORD LIBNXCL_EXPORTABLE NXCCopyDCI(DWORD dwSrcNodeId, DWORD dwDstNodeId,
868 DWORD dwNumItems, DWORD *pdwItemList);
7ac0c0a8 869DWORD LIBNXCL_EXPORTABLE NXCItemIndex(NXC_DCI_LIST *pItemList, DWORD dwItemId);
b9b4ec17
VK
870DWORD LIBNXCL_EXPORTABLE NXCGetDCIData(DWORD dwNodeId, DWORD dwItemId, DWORD dwMaxRows,
871 DWORD dwTimeFrom, DWORD dwTimeTo, NXC_DCI_DATA **ppData);
4c20673b
VK
872void LIBNXCL_EXPORTABLE NXCDestroyDCIData(NXC_DCI_DATA *pData);
873NXC_DCI_ROW LIBNXCL_EXPORTABLE *NXCGetRowPtr(NXC_DCI_DATA *pData, DWORD dwRow);
899f2093
VK
874DWORD LIBNXCL_EXPORTABLE NXCAddThresholdToItem(NXC_DCI *pItem, NXC_DCI_THRESHOLD *pThreshold);
875BOOL LIBNXCL_EXPORTABLE NXCDeleteThresholdFromItem(NXC_DCI *pItem, DWORD dwIndex);
876BOOL LIBNXCL_EXPORTABLE NXCSwapThresholds(NXC_DCI *pItem, DWORD dwIndex1, DWORD dwIndex2);
7ec6cca8 877
a7d07192
VK
878DWORD LIBNXCL_EXPORTABLE NXCGetMIBList(NXC_MIB_LIST **ppMibList);
879void LIBNXCL_EXPORTABLE NXCDestroyMIBList(NXC_MIB_LIST *pMibList);
b40371d4 880DWORD LIBNXCL_EXPORTABLE NXCDownloadMIBFile(TCHAR *pszName, TCHAR *pszDestDir);
a7d07192
VK
881
882DWORD LIBNXCL_EXPORTABLE NXCOpenEventPolicy(NXC_EPP **ppEventPolicy);
883DWORD LIBNXCL_EXPORTABLE NXCCloseEventPolicy(void);
884DWORD LIBNXCL_EXPORTABLE NXCSaveEventPolicy(NXC_EPP *pEventPolicy);
885void LIBNXCL_EXPORTABLE NXCDestroyEventPolicy(NXC_EPP *pEventPolicy);
ef44d5ea 886void LIBNXCL_EXPORTABLE NXCDeletePolicyRule(NXC_EPP *pEventPolicy, DWORD dwRule);
a7d07192 887
b40371d4
AK
888DWORD LIBNXCL_EXPORTABLE NXCSyncImages(NXC_IMAGE_LIST **ppImageList, TCHAR *pszCacheDir, WORD wFormat);
889DWORD LIBNXCL_EXPORTABLE NXCLoadImageFile(DWORD dwImageId, TCHAR *pszCacheDir, WORD wFormat);
f70fc197 890void LIBNXCL_EXPORTABLE NXCDestroyImageList(NXC_IMAGE_LIST *pImageList);
51bd5a10
VK
891DWORD LIBNXCL_EXPORTABLE NXCLoadDefaultImageList(DWORD *pdwListSize,
892 DWORD **ppdwClassId, DWORD **ppdwImageId);
f70fc197 893
9e41df77
VK
894DWORD LIBNXCL_EXPORTABLE NXCLoadAllAlarms(BOOL bIncludeAck, DWORD *pdwNumAlarms, NXC_ALARM **ppAlarmList);
895DWORD LIBNXCL_EXPORTABLE NXCAcknowlegeAlarm(DWORD dwAlarmId);
896DWORD LIBNXCL_EXPORTABLE NXCDeleteAlarm(DWORD dwAlarmId);
03482383 897
5bfcf934
VK
898DWORD LIBNXCL_EXPORTABLE NXCLoadActions(DWORD *pdwNumActions, NXC_ACTION **ppActionList);
899DWORD LIBNXCL_EXPORTABLE NXCLockActionDB(void);
900DWORD LIBNXCL_EXPORTABLE NXCUnlockActionDB(void);
b40371d4 901DWORD LIBNXCL_EXPORTABLE NXCCreateAction(TCHAR *pszName, DWORD *pdwNewId);
5bfcf934
VK
902DWORD LIBNXCL_EXPORTABLE NXCModifyAction(NXC_ACTION *pAction);
903DWORD LIBNXCL_EXPORTABLE NXCDeleteAction(DWORD dwActionId);
904
80ffed5a
VK
905#ifdef __cplusplus
906}
907#endif
908
7ec6cca8
VK
909#endif /* LIBNXCL_NO_DECLARATIONS */
910
80ffed5a 911#endif /* _nxclapi_h_ */