6cf15f885099ff8ffa05ae82ba07f1bd88f657d8
[public/netxms.git] / include / nxclapi.h
1 /*
2 ** NetXMS - Network Management System
3 ** Client Library API
4 ** Copyright (C) 2004 Victor Kirhenshtein
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
15 **
16 ** You should have received a copy of the GNU General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 **
20 ** $module: nxclapi.h
21 **
22 **/
23
24 #ifndef _nxclapi_h_
25 #define _nxclapi_h_
26
27 #include <nms_common.h>
28 #include <nms_util.h>
29 #include <nxevent.h>
30 #include <nximage.h>
31 #include <nxcscpapi.h>
32
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
43
44 //
45 // Session handle type
46 //
47
48 typedef void * NXC_SESSION;
49
50
51 //
52 // Some constants
53 //
54
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
60 #define MAX_USER_NAME 64
61 #define MAX_USER_FULLNAME 128
62 #define MAX_USER_DESCR 256
63 #define MAX_ITEM_NAME 256
64 #define MAX_STRING_VALUE 256
65 #define GROUP_FLAG ((DWORD)0x80000000)
66 #define GROUP_EVERYONE ((DWORD)0x80000000)
67 #define INVALID_UID ((DWORD)0xFFFFFFFF)
68 #define OBJECT_STATUS_COUNT 9
69 #define MAX_RCPT_ADDR_LEN 256
70 #define MAX_EMAIL_SUBJECT_LEN 256
71 #define MAC_ADDR_LENGTH 6
72
73
74 //
75 // Image formats
76 //
77
78 #define IMAGE_FORMAT_ICO 0
79 #define IMAGE_FORMAT_PNG 1
80
81
82 //
83 // Authentication methods
84 //
85
86 #define AUTH_NONE 0
87 #define AUTH_PLAINTEXT 1
88 #define AUTH_MD5_HASH 2
89 #define AUTH_SHA1_HASH 3
90
91
92 //
93 // Forced poll types
94 //
95
96 #define POLL_STATUS 1
97 #define POLL_CONFIGURATION 2
98
99
100 //
101 // Object types
102 //
103
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
112 #define OBJECT_TEMPLATE 8
113 #define OBJECT_TEMPLATEGROUP 9
114 #define OBJECT_TEMPLATEROOT 10
115
116
117 //
118 // Object's status
119 //
120
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
143
144
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
154 #define NF_IS_PRINTER 0x0020
155 #define NS_IS_OSPF 0x0040
156
157
158 //
159 // Events
160 //
161
162 #define NXC_EVENT_ERROR 1
163 #define NXC_EVENT_NEW_ELOG_RECORD 2
164 #define NXC_EVENT_USER_DB_CHANGED 3
165 #define NXC_EVENT_OBJECT_CHANGED 4
166 #define NXC_EVENT_NOTIFICATION 5
167
168
169 //
170 // Errors
171 //
172
173 #define NXC_ERR_INTERNAL 1
174
175
176 //
177 // States (used both by client library and server)
178 //
179
180 #define STATE_DISCONNECTED 0
181 #define STATE_CONNECTING 1
182 #define STATE_CONNECTED 2
183 #define STATE_AUTHENTICATED 3
184
185
186 //
187 // Notification codes
188 //
189
190 #define NX_NOTIFY_SHUTDOWN 1
191 #define NX_NOTIFY_EVENTDB_CHANGED 2
192 #define NX_NOTIFY_ALARM_DELETED 3
193 #define NX_NOTIFY_NEW_ALARM 4
194 #define NX_NOTIFY_ALARM_ACKNOWLEGED 5
195 #define NX_NOTIFY_ACTION_CREATED 6
196 #define NX_NOTIFY_ACTION_MODIFIED 7
197 #define NX_NOTIFY_ACTION_DELETED 8
198
199
200 //
201 // Request completion codes
202 //
203
204 #define RCC_SUCCESS ((DWORD)0)
205 #define RCC_COMPONENT_LOCKED ((DWORD)1)
206 #define RCC_ACCESS_DENIED ((DWORD)2)
207 #define RCC_INVALID_REQUEST ((DWORD)3)
208 #define RCC_TIMEOUT ((DWORD)4)
209 #define RCC_OUT_OF_STATE_REQUEST ((DWORD)5)
210 #define RCC_DB_FAILURE ((DWORD)6)
211 #define RCC_INVALID_OBJECT_ID ((DWORD)7)
212 #define RCC_ALREADY_EXIST ((DWORD)8)
213 #define RCC_COMM_FAILURE ((DWORD)9)
214 #define RCC_SYSTEM_FAILURE ((DWORD)10)
215 #define RCC_INVALID_USER_ID ((DWORD)11)
216 #define RCC_INVALID_ARGUMENT ((DWORD)12)
217 #define RCC_DUPLICATE_DCI ((DWORD)13)
218 #define RCC_INVALID_DCI_ID ((DWORD)14)
219 #define RCC_OUT_OF_MEMORY ((DWORD)15)
220 #define RCC_IO_ERROR ((DWORD)16)
221 #define RCC_INCOMPATIBLE_OPERATION ((DWORD)17)
222 #define RCC_OBJECT_CREATION_FAILED ((DWORD)18)
223 #define RCC_OBJECT_LOOP ((DWORD)19)
224 #define RCC_INVALID_OBJECT_NAME ((DWORD)20)
225 #define RCC_INVALID_ALARM_ID ((DWORD)21)
226 #define RCC_INVALID_ACTION_ID ((DWORD)22)
227 #define RCC_OPERATION_IN_PROGRESS ((DWORD)23)
228 #define RCC_DCI_COPY_ERRORS ((DWORD)24)
229 #define RCC_INVALID_EVENT_CODE ((DWORD)25)
230 #define RCC_NO_WOL_INTERFACES ((DWORD)26)
231 #define RCC_NO_MAC_ADDRESS ((DWORD)27)
232 #define RCC_NOT_IMPLEMENTED ((DWORD)28)
233 #define RCC_INVALID_TRAP_ID ((DWORD)29)
234 #define RCC_DCI_NOT_SUPPORTED ((DWORD)30)
235 #define RCC_VERSION_MISMATCH ((DWORD)31)
236
237
238 //
239 // Mask bits for NXCModifyEventTemplate()
240 //
241
242 #define EM_SEVERITY ((DWORD)0x01)
243 #define EM_FLAGS ((DWORD)0x02)
244 #define EM_NAME ((DWORD)0x04)
245 #define EM_MESSAGE ((DWORD)0x08)
246 #define EM_DESCRIPTION ((DWORD)0x10)
247 #define EM_ALL ((DWORD)0x1F)
248
249
250 //
251 // Mask bits (flags) for NXCModifyObject()
252 //
253
254 #define OBJ_UPDATE_NAME ((DWORD)0x0001)
255 #define OBJ_UPDATE_AGENT_PORT ((DWORD)0x0002)
256 #define OBJ_UPDATE_AGENT_AUTH ((DWORD)0x0004)
257 #define OBJ_UPDATE_AGENT_SECRET ((DWORD)0x0008)
258 #define OBJ_UPDATE_SNMP_VERSION ((DWORD)0x0010)
259 #define OBJ_UPDATE_SNMP_COMMUNITY ((DWORD)0x0020)
260 #define OBJ_UPDATE_ACL ((DWORD)0x0040)
261 #define OBJ_UPDATE_IMAGE ((DWORD)0x0080)
262 #define OBJ_UPDATE_DESCRIPTION ((DWORD)0x0100)
263 #define OBJ_UPDATE_ALL ((DWORD)0x01FF)
264
265
266 //
267 // Global user rights
268 //
269
270 #define SYSTEM_ACCESS_MANAGE_USERS 0x0001
271 #define SYSTEM_ACCESS_SERVER_CONFIG 0x0002
272 #define SYSTEM_ACCESS_CONFIGURE_TRAPS 0x0004
273 #define SYSTEM_ACCESS_DROP_CONNECTIONS 0x0008
274 #define SYSTEM_ACCESS_VIEW_EVENT_DB 0x0010
275 #define SYSTEM_ACCESS_EDIT_EVENT_DB 0x0020
276 #define SYSTEM_ACCESS_EPP 0x0040
277 #define SYSTEM_ACCESS_MANAGE_ACTIONS 0x0080
278
279 #define SYSTEM_ACCESS_FULL 0x00FF
280
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
290 #define OBJECT_ACCESS_READ_ALARMS 0x00000010
291 #define OBJECT_ACCESS_CONTROL 0x00000020
292 #define OBJECT_ACCESS_ACK_ALARMS 0x00000040
293 #define OBJECT_ACCESS_SEND_EVENTS 0x00000080
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
304 #define UF_CANNOT_CHANGE_PASSWORD 0x0010
305
306
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
316 //
317 // Data types
318 //
319
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
326
327
328 //
329 // Data sources
330 //
331
332 #define DS_INTERNAL 0
333 #define DS_NATIVE_AGENT 1
334 #define DS_SNMP_AGENT 2
335
336
337 //
338 // Item status
339 //
340
341 #define ITEM_STATUS_ACTIVE 0
342 #define ITEM_STATUS_DISABLED 1
343 #define ITEM_STATUS_NOT_SUPPORTED 2
344
345
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
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
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
382 #define RF_DISABLED 0x0010
383 #define RF_SEVERITY_INFO 0x0100
384 #define RF_SEVERITY_WARNING 0x0200
385 #define RF_SEVERITY_MINOR 0x0400
386 #define RF_SEVERITY_MAJOR 0x0800
387 #define RF_SEVERITY_CRITICAL 0x1000
388
389
390 //
391 // Action types
392 //
393
394 #define ACTION_EXEC 0
395 #define ACTION_REMOTE 1
396 #define ACTION_SEND_EMAIL 2
397 #define ACTION_SEND_SMS 3
398
399
400 //
401 // Action structure
402 //
403
404 typedef struct
405 {
406 DWORD dwId;
407 int iType;
408 BOOL bIsDisabled;
409 TCHAR szName[MAX_OBJECT_NAME];
410 TCHAR szRcptAddr[MAX_RCPT_ADDR_LEN];
411 TCHAR szEmailSubject[MAX_EMAIL_SUBJECT_LEN];
412 TCHAR *pszData;
413 } NXC_ACTION;
414
415
416 //
417 // Alarm structure
418 //
419
420 typedef struct
421 {
422 DWORD dwAlarmId; // Unique alarm ID
423 DWORD dwTimeStamp; // Timestamp in time() format
424 DWORD dwSourceObject; // Source object ID
425 DWORD dwSourceEventCode;// Originating event code
426 QWORD qwSourceEventId; // Originating event ID
427 TCHAR szMessage[MAX_DB_STRING];
428 TCHAR szKey[MAX_DB_STRING];
429 WORD wSeverity; // Alarm's severity
430 WORD wIsAck; // Non-zero if acknowleged
431 DWORD dwAckByUser; // Id of user who acknowleges this alarm (0 for system)
432 } NXC_ALARM;
433
434
435 //
436 // Event log record structure
437 //
438
439 typedef struct
440 {
441 QWORD qwEventId;
442 DWORD dwTimeStamp;
443 DWORD dwEventCode;
444 DWORD dwSourceId;
445 DWORD dwSeverity;
446 #ifdef UNICODE
447 WCHAR szMessage[MAX_EVENT_MSG_LENGTH];
448 #else
449 char szMessage[MAX_EVENT_MSG_LENGTH * sizeof(WCHAR)];
450 #endif
451 } NXC_EVENT;
452
453
454 //
455 // Image information
456 //
457
458 typedef struct
459 {
460 DWORD dwId;
461 TCHAR szName[MAX_OBJECT_NAME];
462 BYTE hash[MD5_DIGEST_SIZE];
463 } NXC_IMAGE;
464
465
466 //
467 // Image list
468 //
469
470 typedef struct
471 {
472 DWORD dwNumImages;
473 NXC_IMAGE *pImageList;
474 } NXC_IMAGE_LIST;
475
476
477 //
478 // Trap parameter mapping entry
479 //
480
481 struct NXC_OID_MAP
482 {
483 DWORD *pdwObjectId; // Trap OID
484 DWORD dwOidLen; // Trap OID length
485 TCHAR szDescription[MAX_DB_STRING];
486 };
487
488
489 //
490 // Trap configuration entry
491 //
492
493 struct NXC_TRAP_CFG_ENTRY
494 {
495 DWORD dwId; // Entry ID
496 DWORD *pdwObjectId; // Trap OID
497 DWORD dwOidLen; // Trap OID length
498 DWORD dwEventCode; // Event code
499 DWORD dwNumMaps; // Number of parameter mappings
500 NXC_OID_MAP *pMaps;
501 TCHAR szDescription[MAX_DB_STRING];
502 };
503
504
505 /********************************************************************
506 * Following part of this file shouldn't be included by server code *
507 ********************************************************************/
508
509 #ifndef LIBNXCL_NO_DECLARATIONS
510
511
512 //
513 // Callbacks data types
514 //
515
516 typedef void (* NXC_EVENT_HANDLER)(NXC_SESSION hSession, DWORD dwEvent, DWORD dwCode, void *pArg);
517 typedef void (* NXC_DEBUG_CALLBACK)(TCHAR *pMsg);
518
519
520 //
521 // Event configuration structure
522 //
523
524 typedef struct
525 {
526 DWORD dwCode;
527 DWORD dwSeverity;
528 DWORD dwFlags;
529 TCHAR szName[MAX_EVENT_NAME];
530 TCHAR *pszMessage;
531 TCHAR *pszDescription;
532 } NXC_EVENT_TEMPLATE;
533
534
535 //
536 // Entry in object's ACL
537 //
538
539 typedef struct
540 {
541 DWORD dwUserId;
542 DWORD dwAccessRights;
543 } NXC_ACL_ENTRY;
544
545
546 //
547 // Network object structure
548 //
549
550 typedef struct
551 {
552 DWORD dwId; // Unique object's identifier
553 int iClass; // Object's class
554 int iStatus; // Object's status
555 DWORD dwIpAddr; // IP address
556 TCHAR szName[MAX_OBJECT_NAME];
557 DWORD dwNumParents;
558 DWORD *pdwParentList;
559 DWORD dwNumChilds;
560 DWORD *pdwChildList;
561 BOOL bIsDeleted; // TRUE for deleted objects
562 BOOL bInheritRights;
563 DWORD dwAclSize;
564 NXC_ACL_ENTRY *pAccessList;
565 DWORD dwImage; // Image ID or IMG_DEFAULT for default image
566 union
567 {
568 struct
569 {
570 DWORD dwIpNetMask; // Ip netmask.
571 DWORD dwIfIndex; // Interface index.
572 DWORD dwIfType; // Interface type
573 BYTE bMacAddr[MAC_ADDR_LENGTH];
574 } iface;
575 struct
576 {
577 DWORD dwFlags;
578 DWORD dwDiscoveryFlags;
579 DWORD dwNodeType;
580 TCHAR szSharedSecret[MAX_SECRET_LENGTH];
581 TCHAR szCommunityString[MAX_COMMUNITY_LENGTH];
582 TCHAR szObjectId[MAX_OID_LENGTH];
583 WORD wAgentPort; // Listening TCP port for native agent
584 WORD wAuthMethod; // Native agent's authentication method
585 TCHAR *pszDescription;
586 WORD wSNMPVersion;
587 } node;
588 struct
589 {
590 DWORD dwIpNetMask;
591 } subnet;
592 struct
593 {
594 DWORD dwCategory;
595 TCHAR *pszDescription;
596 } container;
597 struct
598 {
599 DWORD dwVersion;
600 TCHAR *pszDescription;
601 } dct;
602 };
603 } NXC_OBJECT;
604
605
606 //
607 // Structure with data for NXCModifyObject
608 //
609
610 typedef struct
611 {
612 DWORD dwObjectId;
613 DWORD dwFlags;
614 TCHAR *pszName;
615 TCHAR *pszDescription;
616 int iAgentPort;
617 int iAuthType;
618 TCHAR *pszSecret;
619 TCHAR *pszCommunity;
620 BOOL bInheritRights;
621 DWORD dwImage;
622 DWORD dwAclSize;
623 NXC_ACL_ENTRY *pAccessList;
624 WORD wSNMPVersion;
625 } NXC_OBJECT_UPDATE;
626
627
628 //
629 // NetXMS user information structure
630 //
631
632 typedef struct
633 {
634 TCHAR szName[MAX_USER_NAME];
635 DWORD dwId;
636 WORD wFlags;
637 WORD wSystemRights;
638 DWORD dwNumMembers; // Only for groups
639 DWORD *pdwMemberList; // Only for groups
640 TCHAR szFullName[MAX_USER_FULLNAME]; // Only for users
641 TCHAR szDescription[MAX_USER_DESCR];
642 } NXC_USER;
643
644
645 //
646 // Data collection item threshold structure
647 //
648
649 typedef struct
650 {
651 DWORD dwId;
652 DWORD dwEvent;
653 WORD wFunction;
654 WORD wOperation;
655 DWORD dwArg1;
656 DWORD dwArg2;
657 union
658 {
659 DWORD dwInt32;
660 INT64 qwInt64;
661 double dFloat;
662 TCHAR szString[MAX_STRING_VALUE];
663 } value;
664 } NXC_DCI_THRESHOLD;
665
666
667 //
668 // Data collection item structure
669 //
670
671 typedef struct
672 {
673 DWORD dwId;
674 DWORD dwTemplateId;
675 TCHAR szName[MAX_ITEM_NAME];
676 TCHAR szDescription[MAX_DB_STRING];
677 TCHAR szInstance[MAX_DB_STRING];
678 int iPollingInterval;
679 int iRetentionTime;
680 BYTE iSource;
681 BYTE iDataType;
682 BYTE iStatus;
683 BYTE iDeltaCalculation;
684 DWORD dwNumThresholds;
685 NXC_DCI_THRESHOLD *pThresholdList;
686 TCHAR *pszFormula;
687 } NXC_DCI;
688
689
690 //
691 // Node's data collection list information
692 //
693
694 typedef struct
695 {
696 DWORD dwNodeId;
697 DWORD dwNumItems;
698 NXC_DCI *pItems;
699 } NXC_DCI_LIST;
700
701
702 //
703 // Row structure
704 //
705
706 #pragma pack(1)
707
708 typedef struct
709 {
710 DWORD dwTimeStamp;
711 union
712 {
713 DWORD dwInt32;
714 INT64 qwInt64;
715 double dFloat;
716 TCHAR szString[MAX_STRING_VALUE];
717 } value;
718 } NXC_DCI_ROW;
719
720 #pragma pack()
721
722
723 //
724 // DCI's collected data
725 //
726
727 typedef struct
728 {
729 DWORD dwNodeId; // Owner's node id
730 DWORD dwItemId; // Item id
731 DWORD dwNumRows; // Number of rows in set
732 WORD wDataType; // Data type (integer, string, etc.)
733 WORD wRowSize; // Size of single row in bytes
734 NXC_DCI_ROW *pRows; // Array of rows
735 } NXC_DCI_DATA;
736
737
738 //
739 // MIB file list
740 //
741
742 typedef struct
743 {
744 DWORD dwNumFiles;
745 TCHAR **ppszName;
746 BYTE **ppHash;
747 } NXC_MIB_LIST;
748
749
750 //
751 // Event processing policy rule
752 //
753
754 typedef struct
755 {
756 DWORD dwFlags;
757 DWORD dwId;
758 DWORD dwNumActions;
759 DWORD dwNumEvents;
760 DWORD dwNumSources;
761 DWORD *pdwActionList;
762 DWORD *pdwEventList;
763 DWORD *pdwSourceList;
764 TCHAR *pszComment;
765 TCHAR szAlarmKey[MAX_DB_STRING];
766 TCHAR szAlarmAckKey[MAX_DB_STRING];
767 TCHAR szAlarmMessage[MAX_DB_STRING];
768 WORD wAlarmSeverity;
769 } NXC_EPP_RULE;
770
771
772 //
773 // Event processing policy
774 //
775
776 typedef struct
777 {
778 DWORD dwNumRules;
779 NXC_EPP_RULE *pRuleList;
780 } NXC_EPP;
781
782
783 //
784 // Object creation information structure
785 //
786
787 typedef struct
788 {
789 int iClass;
790 DWORD dwParentId;
791 TCHAR *pszName;
792 union
793 {
794 struct
795 {
796 DWORD dwIpAddr;
797 DWORD dwNetMask;
798 } node;
799 struct
800 {
801 DWORD dwCategory;
802 TCHAR *pszDescription;
803 } container;
804 struct
805 {
806 TCHAR *pszDescription;
807 } templateGroup;
808 } cs;
809 } NXC_OBJECT_CREATE_INFO;
810
811
812 //
813 // Container category
814 //
815
816 typedef struct
817 {
818 DWORD dwId;
819 DWORD dwImageId;
820 TCHAR szName[MAX_OBJECT_NAME];
821 TCHAR *pszDescription;
822 } NXC_CONTAINER_CATEGORY;
823
824
825 //
826 // Container categories list
827 //
828
829 typedef struct
830 {
831 DWORD dwNumElements;
832 NXC_CONTAINER_CATEGORY *pElements;
833 } NXC_CC_LIST;
834
835
836 //
837 // Functions
838 //
839
840 #ifdef __cplusplus
841 extern "C" {
842 #endif
843
844 DWORD LIBNXCL_EXPORTABLE NXCGetVersion(void);
845 const TCHAR LIBNXCL_EXPORTABLE *NXCGetErrorText(DWORD dwError);
846
847 BOOL LIBNXCL_EXPORTABLE NXCInitialize(void);
848 void LIBNXCL_EXPORTABLE NXCShutdown(void);
849 void LIBNXCL_EXPORTABLE NXCSetDebugCallback(NXC_DEBUG_CALLBACK pFunc);
850
851 DWORD LIBNXCL_EXPORTABLE NXCConnect(TCHAR *szServer, TCHAR *szLogin,
852 TCHAR *szPassword, NXC_SESSION *phSession);
853 void LIBNXCL_EXPORTABLE NXCDisconnect(NXC_SESSION hSession);
854 void LIBNXCL_EXPORTABLE NXCSetEventHandler(NXC_SESSION hSession, NXC_EVENT_HANDLER pHandler);
855 void LIBNXCL_EXPORTABLE NXCSetCommandTimeout(NXC_SESSION hSession, DWORD dwTimeout);
856
857 DWORD LIBNXCL_EXPORTABLE NXCSyncObjects(NXC_SESSION hSession);
858 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectById(NXC_SESSION hSession, DWORD dwId);
859 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectByName(NXC_SESSION hSession, TCHAR *pszName);
860 void LIBNXCL_EXPORTABLE NXCEnumerateObjects(NXC_SESSION hSession, BOOL (* pHandler)(NXC_OBJECT *));
861 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetTopologyRootObject(NXC_SESSION hSession);
862 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetServiceRootObject(NXC_SESSION hSession);
863 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCGetTemplateRootObject(NXC_SESSION hSession);
864 void LIBNXCL_EXPORTABLE *NXCGetObjectIndex(NXC_SESSION hSession, DWORD *pdwNumObjects);
865 void LIBNXCL_EXPORTABLE NXCLockObjectIndex(NXC_SESSION hSession);
866 void LIBNXCL_EXPORTABLE NXCUnlockObjectIndex(NXC_SESSION hSession);
867 DWORD LIBNXCL_EXPORTABLE NXCModifyObject(NXC_SESSION hSession, NXC_OBJECT_UPDATE *pData);
868 DWORD LIBNXCL_EXPORTABLE NXCSetObjectMgmtStatus(NXC_SESSION hSession, DWORD dwObjectId, BOOL bIsManaged);
869 DWORD LIBNXCL_EXPORTABLE NXCCreateObject(NXC_SESSION hSession, NXC_OBJECT_CREATE_INFO *pCreateInfo, DWORD *pdwObjectId);
870 DWORD LIBNXCL_EXPORTABLE NXCBindObject(NXC_SESSION hSession, DWORD dwParentObject, DWORD dwChildObject);
871 DWORD LIBNXCL_EXPORTABLE NXCUnbindObject(NXC_SESSION hSession, DWORD dwParentObject, DWORD dwChildObject);
872 DWORD LIBNXCL_EXPORTABLE NXCDeleteObject(NXC_SESSION hSession, DWORD dwObject);
873 DWORD LIBNXCL_EXPORTABLE NXCPollNode(NXC_SESSION hSession, DWORD dwObjectId, int iPollType,
874 void (* pCallback)(TCHAR *, void *), void *pArg);
875 DWORD LIBNXCL_EXPORTABLE NXCWakeUpNode(NXC_SESSION hSession, DWORD dwObjectId);
876
877 DWORD LIBNXCL_EXPORTABLE NXCLoadCCList(NXC_SESSION hSession, NXC_CC_LIST **ppList);
878 void LIBNXCL_EXPORTABLE NXCDestroyCCList(NXC_CC_LIST *pList);
879
880 DWORD LIBNXCL_EXPORTABLE NXCSyncEvents(NXC_SESSION hSession);
881 DWORD LIBNXCL_EXPORTABLE NXCLoadEventDB(NXC_SESSION hSession);
882 DWORD LIBNXCL_EXPORTABLE NXCSetEventInfo(NXC_SESSION hSession, NXC_EVENT_TEMPLATE *pArg);
883 DWORD LIBNXCL_EXPORTABLE NXCGenerateEventCode(NXC_SESSION hSession, DWORD *pdwEventCode);
884 void LIBNXCL_EXPORTABLE NXCAddEventTemplate(NXC_SESSION hSession, NXC_EVENT_TEMPLATE *pEventTemplate);
885 void LIBNXCL_EXPORTABLE NXCDeleteEDBRecord(NXC_SESSION hSession, DWORD dwEventCode);
886 DWORD LIBNXCL_EXPORTABLE NXCDeleteEventTemplate(NXC_SESSION hSession, DWORD dwEventCode);
887 DWORD LIBNXCL_EXPORTABLE NXCLockEventDB(NXC_SESSION hSession);
888 DWORD LIBNXCL_EXPORTABLE NXCUnlockEventDB(NXC_SESSION hSession);
889 BOOL LIBNXCL_EXPORTABLE NXCGetEventDB(NXC_SESSION hSession, NXC_EVENT_TEMPLATE ***pppTemplateList, DWORD *pdwNumRecords);
890 const TCHAR LIBNXCL_EXPORTABLE *NXCGetEventName(NXC_SESSION hSession, DWORD dwId);
891 BOOL LIBNXCL_EXPORTABLE NXCGetEventNameEx(NXC_SESSION hSession, DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize);
892 int LIBNXCL_EXPORTABLE NXCGetEventSeverity(NXC_SESSION hSession, DWORD dwId);
893 BOOL LIBNXCL_EXPORTABLE NXCGetEventText(NXC_SESSION hSession, DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize);
894 DWORD LIBNXCL_EXPORTABLE NXCSendEvent(NXC_SESSION hSession, DWORD dwEventCode, DWORD dwObjectId, int iNumArgs, TCHAR **pArgList);
895
896 DWORD LIBNXCL_EXPORTABLE NXCLoadUserDB(NXC_SESSION hSession);
897 NXC_USER LIBNXCL_EXPORTABLE *NXCFindUserById(NXC_SESSION hSession, DWORD dwId);
898 BOOL LIBNXCL_EXPORTABLE NXCGetUserDB(NXC_SESSION hSession, NXC_USER **ppUserList, DWORD *pdwNumUsers);
899 DWORD LIBNXCL_EXPORTABLE NXCLockUserDB(NXC_SESSION hSession);
900 DWORD LIBNXCL_EXPORTABLE NXCUnlockUserDB(NXC_SESSION hSession);
901 DWORD LIBNXCL_EXPORTABLE NXCCreateUser(NXC_SESSION hSession, TCHAR *pszName, BOOL bIsGroup, DWORD *pdwNewId);
902 DWORD LIBNXCL_EXPORTABLE NXCDeleteUser(NXC_SESSION hSession, DWORD dwId);
903 DWORD LIBNXCL_EXPORTABLE NXCModifyUser(NXC_SESSION hSession, NXC_USER *pUserInfo);
904 DWORD LIBNXCL_EXPORTABLE NXCSetPassword(NXC_SESSION hSession, DWORD dwUserId, TCHAR *pszNewPassword);
905
906 DWORD LIBNXCL_EXPORTABLE NXCOpenNodeDCIList(NXC_SESSION hSession, DWORD dwNodeId, NXC_DCI_LIST **ppItemList);
907 DWORD LIBNXCL_EXPORTABLE NXCCloseNodeDCIList(NXC_SESSION hSession, NXC_DCI_LIST *pItemList);
908 DWORD LIBNXCL_EXPORTABLE NXCCreateNewDCI(NXC_SESSION hSession, NXC_DCI_LIST *pItemList, DWORD *pdwItemId);
909 DWORD LIBNXCL_EXPORTABLE NXCUpdateDCI(NXC_SESSION hSession, DWORD dwNodeId, NXC_DCI *pItem);
910 DWORD LIBNXCL_EXPORTABLE NXCDeleteDCI(NXC_SESSION hSession, NXC_DCI_LIST *pItemList, DWORD dwItemId);
911 DWORD LIBNXCL_EXPORTABLE NXCSetDCIStatus(NXC_SESSION hSession, DWORD dwNodeId, DWORD dwNumItems,
912 DWORD *pdwItemList, int iStatus);
913 DWORD LIBNXCL_EXPORTABLE NXCCopyDCI(NXC_SESSION hSession, DWORD dwSrcNodeId, DWORD dwDstNodeId,
914 DWORD dwNumItems, DWORD *pdwItemList);
915 DWORD LIBNXCL_EXPORTABLE NXCItemIndex(NXC_DCI_LIST *pItemList, DWORD dwItemId);
916 DWORD LIBNXCL_EXPORTABLE NXCGetDCIData(NXC_SESSION hSession, DWORD dwNodeId, DWORD dwItemId, DWORD dwMaxRows,
917 DWORD dwTimeFrom, DWORD dwTimeTo, NXC_DCI_DATA **ppData);
918 void LIBNXCL_EXPORTABLE NXCDestroyDCIData(NXC_DCI_DATA *pData);
919 NXC_DCI_ROW LIBNXCL_EXPORTABLE *NXCGetRowPtr(NXC_DCI_DATA *pData, DWORD dwRow);
920 DWORD LIBNXCL_EXPORTABLE NXCAddThresholdToItem(NXC_DCI *pItem, NXC_DCI_THRESHOLD *pThreshold);
921 BOOL LIBNXCL_EXPORTABLE NXCDeleteThresholdFromItem(NXC_DCI *pItem, DWORD dwIndex);
922 BOOL LIBNXCL_EXPORTABLE NXCSwapThresholds(NXC_DCI *pItem, DWORD dwIndex1, DWORD dwIndex2);
923 DWORD LIBNXCL_EXPORTABLE NXCQueryParameter(NXC_SESSION hSession, DWORD dwNodeId, int iOrigin, TCHAR *pszParameter,
924 TCHAR *pszBuffer, DWORD dwBufferSize);
925
926 DWORD LIBNXCL_EXPORTABLE NXCGetMIBList(NXC_SESSION hSession, NXC_MIB_LIST **ppMibList);
927 void LIBNXCL_EXPORTABLE NXCDestroyMIBList(NXC_MIB_LIST *pMibList);
928 DWORD LIBNXCL_EXPORTABLE NXCDownloadMIBFile(NXC_SESSION hSession, TCHAR *pszName, TCHAR *pszDestDir);
929
930 DWORD LIBNXCL_EXPORTABLE NXCOpenEventPolicy(NXC_SESSION hSession, NXC_EPP **ppEventPolicy);
931 DWORD LIBNXCL_EXPORTABLE NXCCloseEventPolicy(NXC_SESSION hSession);
932 DWORD LIBNXCL_EXPORTABLE NXCSaveEventPolicy(NXC_SESSION hSession, NXC_EPP *pEventPolicy);
933 void LIBNXCL_EXPORTABLE NXCDestroyEventPolicy(NXC_EPP *pEventPolicy);
934 void LIBNXCL_EXPORTABLE NXCDeletePolicyRule(NXC_EPP *pEventPolicy, DWORD dwRule);
935
936 DWORD LIBNXCL_EXPORTABLE NXCSyncImages(NXC_SESSION hSession, NXC_IMAGE_LIST **ppImageList, TCHAR *pszCacheDir, WORD wFormat);
937 DWORD LIBNXCL_EXPORTABLE NXCLoadImageFile(NXC_SESSION hSession, DWORD dwImageId, TCHAR *pszCacheDir, WORD wFormat);
938 void LIBNXCL_EXPORTABLE NXCDestroyImageList(NXC_IMAGE_LIST *pImageList);
939 DWORD LIBNXCL_EXPORTABLE NXCLoadDefaultImageList(NXC_SESSION hSession, DWORD *pdwListSize,
940 DWORD **ppdwClassId, DWORD **ppdwImageId);
941
942 DWORD LIBNXCL_EXPORTABLE NXCLoadAllAlarms(NXC_SESSION hSession, BOOL bIncludeAck, DWORD *pdwNumAlarms, NXC_ALARM **ppAlarmList);
943 DWORD LIBNXCL_EXPORTABLE NXCAcknowlegeAlarm(NXC_SESSION hSession, DWORD dwAlarmId);
944 DWORD LIBNXCL_EXPORTABLE NXCDeleteAlarm(NXC_SESSION hSession, DWORD dwAlarmId);
945
946 DWORD LIBNXCL_EXPORTABLE NXCLoadActions(NXC_SESSION hSession, DWORD *pdwNumActions, NXC_ACTION **ppActionList);
947 DWORD LIBNXCL_EXPORTABLE NXCLockActionDB(NXC_SESSION hSession);
948 DWORD LIBNXCL_EXPORTABLE NXCUnlockActionDB(NXC_SESSION hSession);
949 DWORD LIBNXCL_EXPORTABLE NXCCreateAction(NXC_SESSION hSession, TCHAR *pszName, DWORD *pdwNewId);
950 DWORD LIBNXCL_EXPORTABLE NXCModifyAction(NXC_SESSION hSession, NXC_ACTION *pAction);
951 DWORD LIBNXCL_EXPORTABLE NXCDeleteAction(NXC_SESSION hSession, DWORD dwActionId);
952
953 DWORD LIBNXCL_EXPORTABLE NXCLockTrapCfg(NXC_SESSION hSession);
954 DWORD LIBNXCL_EXPORTABLE NXCUnlockTrapCfg(NXC_SESSION hSession);
955 DWORD LIBNXCL_EXPORTABLE NXCLoadTrapCfg(NXC_SESSION hSession, DWORD *pdwNumTraps, NXC_TRAP_CFG_ENTRY **ppTrapList);
956 void LIBNXCL_EXPORTABLE NXCDestroyTrapList(DWORD dwNumTraps, NXC_TRAP_CFG_ENTRY *pTrapList);
957 DWORD LIBNXCL_EXPORTABLE NXCCreateTrap(NXC_SESSION hSession, DWORD *pdwTrapId);
958 DWORD LIBNXCL_EXPORTABLE NXCModifyTrap(NXC_SESSION hSession, NXC_TRAP_CFG_ENTRY *pTrap);
959 DWORD LIBNXCL_EXPORTABLE NXCDeleteTrap(NXC_SESSION hSession, DWORD dwTrapId);
960
961 DWORD LIBNXCL_EXPORTABLE NXCAttachWebSession(NXC_SESSION hSession, QWORD qwSID);
962
963 #ifdef __cplusplus
964 }
965 #endif
966
967 #endif /* LIBNXCL_NO_DECLARATIONS */
968
969 #endif /* _nxclapi_h_ */