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