- All component locks moved to memory
[public/netxms.git] / include / nms_cscp.h
CommitLineData
145f8fd9 1/*
7ac71e60 2** NetXMS - Network Management System
145f8fd9
VK
3** Copyright (C) 2003 Victor Kirhenshtein
4**
5** This program is free software; you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation; either version 2 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
19** $module: nms_cscp.h
20**
21**/
22
23#ifndef _nms_cscp_h_
24#define _nms_cscp_h_
25
b04752b5
VK
26
27//
28// Constants
29//
30
31#define SERVER_LISTEN_PORT 4701
8df7ba23
VK
32#define MAX_DCI_STRING_VALUE 256
33#define CSCP_HEADER_SIZE 16
b04752b5
VK
34
35
145f8fd9
VK
36//
37// Data field structure
38//
39
2d2906c0
VK
40#pragma pack(1)
41
145f8fd9
VK
42typedef struct
43{
a5f8dbb8
VK
44 DWORD dwVarId; // Variable identifier
45 BYTE bType; // Data type
46 BYTE bReserved; // Padding
145f8fd9
VK
47 union
48 {
49 struct
50 {
ad441c6e
VK
51 WORD wReserved1;
52 DWORD dwLen;
4332e9d8 53 TCHAR szValue[1];
145f8fd9 54 } string;
a5f8dbb8
VK
55 struct
56 {
ad441c6e 57 WORD wReserved2;
a5f8dbb8 58 DWORD dwInteger;
4a423ca9 59 } integer;
a5f8dbb8
VK
60 struct
61 {
ad441c6e 62 WORD wReserverd3;
521d90e7 63 QWORD qwInt64;
4a423ca9 64 } int64;
f86ffdd2
VK
65 struct
66 {
ad441c6e 67 WORD wReserverd4;
f86ffdd2
VK
68 double dFloat;
69 } fp;
5358362f 70 WORD wInt16;
145f8fd9
VK
71 } data;
72} CSCP_DF;
73
74
75//
76// Message structure
77//
78
79typedef struct
80{
8df7ba23
VK
81 WORD wCode; // Message (command) code
82 WORD wFlags; // Message flags
83 DWORD dwSize; // Message size (including header) in bytes
84 DWORD dwId; // Unique message identifier
85 DWORD dwNumVars; // Number of variables in message
86 CSCP_DF df[1]; // Data fields
145f8fd9
VK
87} CSCP_MESSAGE;
88
8df7ba23
VK
89
90//
91// DCI data header structure
92//
93
94typedef struct
95{
96 DWORD dwItemId;
97 DWORD dwNumRows;
98 DWORD dwDataType;
99} DCI_DATA_HEADER;
100
101
102//
103// DCI data row structure
104//
105
106typedef struct
107{
108 DWORD dwTimeStamp;
109 union
110 {
4c20673b
VK
111 DWORD dwInteger;
112 QWORD qwInt64;
8df7ba23 113 double dFloat;
b40371d4 114 TCHAR szString[MAX_DCI_STRING_VALUE];
8df7ba23
VK
115 } value;
116} DCI_DATA_ROW;
117
f86ffdd2
VK
118
119//
120// DCI threshold structure
121//
122
123typedef struct
124{
125 DWORD dwId;
126 DWORD dwEvent;
127 DWORD dwArg1;
128 DWORD dwArg2;
129 union
130 {
131 DWORD dwInt32;
132 INT64 qwInt64;
133 double dFloat;
b40371d4 134 TCHAR szString[MAX_DCI_STRING_VALUE];
f86ffdd2
VK
135 } value;
136 WORD wFunction;
137 WORD wOperation;
138} DCI_THRESHOLD;
139
2d2906c0
VK
140#pragma pack()
141
145f8fd9 142
e9246d26
VK
143//
144// Data types
145//
146
42d7ed00
VK
147#define CSCP_DT_INTEGER 0
148#define CSCP_DT_STRING 1
149#define CSCP_DT_INT64 2
150#define CSCP_DT_INT16 3
151#define CSCP_DT_BINARY 4
152#define CSCP_DT_FLOAT 5
e9246d26
VK
153
154
a5f8dbb8
VK
155//
156// Message flags
157//
158
b9b4ec17 159#define MF_BINARY 0x0001
a5f8dbb8
VK
160
161
145f8fd9
VK
162//
163// Message (command) codes
164//
165
a5f8dbb8
VK
166#define CMD_LOGIN 0x0001
167#define CMD_LOGIN_RESP 0x0002
168#define CMD_KEEPALIVE 0x0003
169#define CMD_EVENT 0x0004
170#define CMD_GET_OBJECTS 0x0005
171#define CMD_OBJECT 0x0006
172#define CMD_DELETE_OBJECT 0x0007
effb51ab 173#define CMD_MODIFY_OBJECT 0x0008
a5f8dbb8
VK
174#define CMD_OBJECT_LIST_END 0x0009
175#define CMD_OBJECT_UPDATE 0x000A
176#define CMD_GET_EVENTS 0x000B
177#define CMD_EVENT_LIST_END 0x000C
178#define CMD_GET_CONFIG_VARLIST 0x000D
179#define CMD_SET_CONFIG_VARIABLE 0x000E
180#define CMD_CONFIG_VARIABLE 0x000F
181#define CMD_CONFIG_VARLIST_END 0x0010
182#define CMD_DELETE_CONFIG_VARIABLE 0x0011
b601b1fa 183#define CMD_NOTIFY 0x0012
8f7e2482
VK
184#define CMD_TRAP 0x0013
185#define CMD_OPEN_EPP 0x0014
186#define CMD_CLOSE_EPP 0x0015
4997be5c
VK
187#define CMD_SAVE_EPP 0x0016
188#define CMD_EPP_RECORD 0x0017
37c4d6aa
VK
189#define CMD_LOCK_EVENT_DB 0x0018
190#define CMD_UNLOCK_EVENT_DB 0x0019
4997be5c
VK
191#define CMD_SET_EVENT_INFO 0x001A
192#define CMD_EVENT_DB_RECORD 0x001B
37c4d6aa 193#define CMD_LOAD_EVENT_DB 0x001C
878c92bc 194#define CMD_REQUEST_COMPLETED 0x001D
5ac3236b
VK
195#define CMD_LOAD_USER_DB 0x001E
196#define CMD_USER_DATA 0x001F
197#define CMD_GROUP_DATA 0x0020
198#define CMD_USER_DB_EOF 0x0021
34d95c13
VK
199#define CMD_UPDATE_USER 0x0022
200#define CMD_DELETE_USER 0x0023
201#define CMD_CREATE_USER 0x0024
202#define CMD_LOCK_USER_DB 0x0025
203#define CMD_UNLOCK_USER_DB 0x0026
984542f8 204#define CMD_USER_DB_UPDATE 0x0027
8c18110a 205#define CMD_SET_PASSWORD 0x0028
85b1c3c4
VK
206#define CMD_GET_NODE_DCI_LIST 0x0029
207#define CMD_NODE_DCI 0x002A
208#define CMD_NODE_DCI_LIST_END 0x002B
209#define CMD_DELETE_NODE_DCI 0x002C
210#define CMD_MODIFY_NODE_DCI 0x002D
211#define CMD_UNLOCK_NODE_DCI_LIST 0x002E
c1c39152 212#define CMD_SET_OBJECT_MGMT_STATUS 0x002F
9ed4eaff 213#define CMD_CREATE_NEW_DCI 0x0030
7ac0c0a8 214#define CMD_GET_DCI_DATA 0x0031
8df7ba23 215#define CMD_DCI_DATA 0x0032
a7d07192
VK
216#define CMD_GET_MIB_LIST 0x0033
217#define CMD_GET_MIB 0x0034
218#define CMD_MIB_LIST 0x0035
219#define CMD_MIB 0x0036
ef44d5ea 220#define CMD_CREATE_OBJECT 0x0037
3421c063
VK
221#define CMD_GET_EVENT_NAMES 0x0038
222#define CMD_EVENT_NAME_LIST 0x0039
e6b958c4
VK
223#define CMD_BIND_OBJECT 0x003A
224#define CMD_UNBIND_OBJECT 0x003B
e641b7d0
VK
225#define CMD_GET_IMAGE_LIST 0x003C
226#define CMD_LOAD_IMAGE_FILE 0x003D
227#define CMD_IMAGE_LIST 0x003E
228#define CMD_IMAGE_FILE 0x003F
deaa4491
VK
229#define CMD_AUTHENTICATE 0x0040
230#define CMD_GET_PARAMETER 0x0041
231#define CMD_GET_LIST 0x0042
8f7e2482
VK
232#define CMD_ACTION 0x0043
233#define CMD_GET_DEFAULT_IMAGE_LIST 0x0044
234#define CMD_DEFAULT_IMAGE_LIST 0x0045
03482383
VK
235#define CMD_GET_ALL_ALARMS 0x0046
236#define CMD_GET_ALARM 0x0047
237#define CMD_ACK_ALARM 0x0048
238#define CMD_ALARM_UPDATE 0x0049
239#define CMD_ALARM_DATA 0x004A
9e41df77 240#define CMD_DELETE_ALARM 0x004B
c9363772
VK
241#define CMD_LOCK_ACTION_DB 0x004C
242#define CMD_UNLOCK_ACTION_DB 0x004D
243#define CMD_LOAD_ACTIONS 0x004E
244#define CMD_ACTION_DB_UPDATE 0x004F
245#define CMD_MODIFY_ACTION 0x0050
246#define CMD_CREATE_ACTION 0x0051
247#define CMD_DELETE_ACTION 0x0052
31115ff9 248#define CMD_ACTION_DATA 0x0053
6849d9be
VK
249#define CMD_GET_CONTAINER_CAT_LIST 0x0054
250#define CMD_CONTAINER_CAT_DATA 0x0055
251#define CMD_DELETE_CONTAINER_CAT 0x0056
252#define CMD_CREATE_CONTAINER_CAT 0x0057
253#define CMD_MODIFY_CONTAINER_CAT 0x0058
0b89f5fb
VK
254#define CMD_POLL_NODE 0x0059
255#define CMD_POLLING_INFO 0x005A
933aee5c 256#define CMD_COPY_DCI 0x005B
ed1140dc 257#define CMD_WAKEUP_NODE 0x005C
37c4d6aa
VK
258#define CMD_DELETE_EVENT_TEMPLATE 0x005D
259#define CMD_GENERATE_EVENT_ID 0x005E
b4895bbe
VK
260#define CMD_LOCK_TRAP_CFG 0x005F
261#define CMD_UNLOCK_TRAP_CFG 0x0060
262#define CMD_CREATE_TRAP 0x0061
263#define CMD_MODIFY_TRAP 0x0062
264#define CMD_DELETE_TRAP 0x0063
265#define CMD_LOAD_TRAP_LIST 0x0064
a5f8dbb8
VK
266
267
268//
269// Variable identifiers
270//
271
552faa91
VK
272#define VID_LOGIN_NAME ((DWORD)1)
273#define VID_PASSWORD ((DWORD)2)
274#define VID_OBJECT_ID ((DWORD)3)
275#define VID_OBJECT_NAME ((DWORD)4)
276#define VID_OBJECT_CLASS ((DWORD)5)
8c18110a 277#define VID_SNMP_VERSION ((DWORD)6)
552faa91
VK
278#define VID_PARENT_CNT ((DWORD)7)
279#define VID_IP_ADDRESS ((DWORD)8)
280#define VID_IP_NETMASK ((DWORD)9)
281#define VID_OBJECT_STATUS ((DWORD)10)
282#define VID_IF_INDEX ((DWORD)11)
283#define VID_IF_TYPE ((DWORD)12)
284#define VID_FLAGS ((DWORD)13)
285#define VID_DISCOVERY_FLAGS ((DWORD)14)
286#define VID_AGENT_PORT ((DWORD)15)
287#define VID_AUTH_METHOD ((DWORD)16)
288#define VID_SHARED_SECRET ((DWORD)17)
289#define VID_COMMUNITY_STRING ((DWORD)18)
290#define VID_SNMP_OID ((DWORD)19)
291#define VID_NAME ((DWORD)20)
292#define VID_VALUE ((DWORD)21)
293#define VID_ERROR ((DWORD)22)
294#define VID_NOTIFICATION_CODE ((DWORD)23)
295#define VID_EVENT_ID ((DWORD)24)
296#define VID_SEVERITY ((DWORD)25)
297#define VID_MESSAGE ((DWORD)26)
298#define VID_DESCRIPTION ((DWORD)27)
299#define VID_RCC ((DWORD)28) /* RCC == Request Completion Code */
300#define VID_LOCKED_BY ((DWORD)29)
301#define VID_IS_DELETED ((DWORD)30)
302#define VID_CHILD_CNT ((DWORD)31)
effb51ab
VK
303#define VID_ACL_SIZE ((DWORD)32)
304#define VID_INHERIT_RIGHTS ((DWORD)33)
5ac3236b
VK
305#define VID_USER_NAME ((DWORD)34)
306#define VID_USER_ID ((DWORD)35)
307#define VID_USER_SYS_RIGHTS ((DWORD)36)
308#define VID_USER_FLAGS ((DWORD)37)
309#define VID_NUM_MEMBERS ((DWORD)38) /* Number of members in users group */
34d95c13 310#define VID_IS_GROUP ((DWORD)39)
54abbe0e
VK
311#define VID_USER_FULL_NAME ((DWORD)40)
312#define VID_USER_DESCRIPTION ((DWORD)41)
984542f8 313#define VID_UPDATE_TYPE ((DWORD)42)
85b1c3c4
VK
314#define VID_DCI_ID ((DWORD)43)
315#define VID_POLLING_INTERVAL ((DWORD)44)
316#define VID_RETENTION_TIME ((DWORD)45)
317#define VID_DCI_SOURCE_TYPE ((DWORD)46)
318#define VID_DCI_DATA_TYPE ((DWORD)47)
319#define VID_DCI_STATUS ((DWORD)48)
c1c39152 320#define VID_MGMT_STATUS ((DWORD)49)
f599c1d1
VK
321#define VID_MAX_ROWS ((DWORD)50)
322#define VID_TIME_FROM ((DWORD)51)
323#define VID_TIME_TO ((DWORD)52)
b9b4ec17 324#define VID_DCI_DATA ((DWORD)53)
f86ffdd2
VK
325#define VID_NUM_THRESHOLDS ((DWORD)54)
326#define VID_DCI_NUM_MAPS ((DWORD)55)
327#define VID_DCI_MAP_IDS ((DWORD)56)
328#define VID_DCI_MAP_INDEXES ((DWORD)57)
a7d07192
VK
329#define VID_NUM_MIBS ((DWORD)58)
330#define VID_MIB_NAME ((DWORD)59)
331#define VID_MIB_FILE_SIZE ((DWORD)60)
332#define VID_MIB_FILE ((DWORD)61)
333#define VID_COMMENT ((DWORD)62)
334#define VID_ALARM_SEVERITY ((DWORD)63)
335#define VID_ALARM_KEY ((DWORD)64)
336#define VID_ALARM_ACK_KEY ((DWORD)65)
337#define VID_ALARM_MESSAGE ((DWORD)66)
338#define VID_RULE_ID ((DWORD)67)
339#define VID_NUM_SOURCES ((DWORD)68)
340#define VID_NUM_EVENTS ((DWORD)69)
341#define VID_NUM_ACTIONS ((DWORD)70)
342#define VID_RULE_SOURCES ((DWORD)71)
343#define VID_RULE_EVENTS ((DWORD)72)
344#define VID_RULE_ACTIONS ((DWORD)73)
345#define VID_NUM_RULES ((DWORD)74)
ef44d5ea 346#define VID_CATEGORY ((DWORD)75)
e6b958c4
VK
347#define VID_UPDATED_CHILD_LIST ((DWORD)76)
348#define VID_EVENT_NAME_TABLE ((DWORD)77)
349#define VID_PARENT_ID ((DWORD)78)
350#define VID_CHILD_ID ((DWORD)79)
e641b7d0
VK
351#define VID_IMAGE_ID ((DWORD)80)
352#define VID_NUM_IMAGES ((DWORD)81)
353#define VID_IMAGE_LIST ((DWORD)82)
354#define VID_IMAGE_FILE_SIZE ((DWORD)83)
355#define VID_IMAGE_FILE ((DWORD)84)
deaa4491 356#define VID_PARAMETER ((DWORD)85)
901c96c7 357#define VID_NUM_STRINGS ((DWORD)86)
3c774461
VK
358#define VID_ACTION_NAME ((DWORD)87)
359#define VID_NUM_ARGS ((DWORD)88)
2a51a458
VK
360#define VID_IMAGE_ID_LIST ((DWORD)89)
361#define VID_CLASS_ID_LIST ((DWORD)90)
aa3743b2 362#define VID_IMAGE_FORMAT ((DWORD)91)
4de204a3 363#define VID_NOTIFICATION_DATA ((DWORD)92)
03482383
VK
364#define VID_ALARM_ID ((DWORD)93)
365#define VID_TIMESTAMP ((DWORD)94)
366#define VID_ACK_BY_USER ((DWORD)95)
367#define VID_IS_ACK ((DWORD)96)
c9363772 368#define VID_ACTION_ID ((DWORD)97)
15b8d488
VK
369#define VID_IS_DISABLED ((DWORD)98)
370#define VID_ACTION_TYPE ((DWORD)99)
371#define VID_ACTION_DATA ((DWORD)100)
372#define VID_EMAIL_SUBJECT ((DWORD)101)
373#define VID_RCPT_ADDR ((DWORD)102)
6849d9be
VK
374#define VID_CATEGORY_NAME ((DWORD)103)
375#define VID_CATEGORY_ID ((DWORD)104)
333ece94
VK
376#define VID_DCI_DELTA_CALCULATION ((DWORD)105)
377#define VID_DCI_FORMULA ((DWORD)106)
0b89f5fb
VK
378#define VID_POLL_TYPE ((DWORD)107)
379#define VID_POLLER_MESSAGE ((DWORD)108)
933aee5c
VK
380#define VID_SOURCE_OBJECT_ID ((DWORD)109)
381#define VID_DESTINATION_OBJECT_ID ((DWORD)110)
382#define VID_NUM_ITEMS ((DWORD)111)
383#define VID_ITEM_LIST ((DWORD)112)
b50f1100 384#define VID_MAC_ADDR ((DWORD)113)
70573ffe 385#define VID_TEMPLATE_VERSION ((DWORD)114)
18e26ff8 386#define VID_NODE_TYPE ((DWORD)115)
22c38feb 387#define VID_INSTANCE ((DWORD)116)
552faa91 388
effb51ab
VK
389// Variable ranges for object's ACL
390#define VID_ACL_USER_BASE ((DWORD)0x00001000)
391#define VID_ACL_USER_LAST ((DWORD)0x00001FFF)
392#define VID_ACL_RIGHTS_BASE ((DWORD)0x00002000)
393#define VID_ACL_RIGHTS_LAST ((DWORD)0x00002FFF)
552faa91 394
5ac3236b
VK
395// Variable range for user group members
396#define VID_GROUP_MEMBER_BASE ((DWORD)0x00004000)
397#define VID_GROUP_MEMBER_LAST ((DWORD)0x00004FFF)
398
f86ffdd2
VK
399// Variable range for data collection thresholds
400#define VID_DCI_THRESHOLD_BASE ((DWORD)0x00005000)
401#define VID_DCI_THRESHOLD_LAST ((DWORD)0x00005FFF)
402
a7d07192
VK
403// Variable range for MIB list
404#define VID_MIB_NAME_BASE ((DWORD)0x00006000)
405#define VID_MIB_NAME_LAST ((DWORD)0x00006FFF)
406#define VID_MIB_HASH_BASE ((DWORD)0x00007000)
407#define VID_MIB_HASH_LAST ((DWORD)0x00007FFF)
408
f6eade3f
VK
409// Variable range for event argument list
410#define VID_EVENT_ARG_BASE ((DWORD)0x00008000)
411#define VID_EVENT_ARG_LAST ((DWORD)0x00008FFF)
412
552faa91 413// Object information can contain variable number of parent and child objects' ids.
a5f8dbb8 414// Because each variable in message have to have unique identifier,
552faa91 415// we reserver a two range ids for this variables.
effb51ab
VK
416#define VID_PARENT_ID_BASE ((DWORD)0x00003000)
417#define VID_PARENT_ID_LAST ((DWORD)0x00003FFF)
552faa91
VK
418
419// Reservation of 0x7FFFFFFF ids for child object's list
420#define VID_CHILD_ID_BASE ((DWORD)0x80000000)
421#define VID_CHILD_ID_LAST ((DWORD)0xFFFFFFFE)
a5f8dbb8 422
901c96c7
VK
423// Base value for agent's enum values
424#define VID_ENUM_VALUE_BASE ((DWORD)0x10000000)
425
3c774461
VK
426// Base value for agent's action arguments
427#define VID_ACTION_ARG_BASE ((DWORD)0x10000000)
428
a5f8dbb8
VK
429
430//
431// Inline functions
432//
433
b50f1100
VK
434#ifdef __cplusplus
435
a5f8dbb8
VK
436inline BOOL IsBinaryMsg(CSCP_MESSAGE *pMsg)
437{
8df7ba23 438 return ntohs(pMsg->wFlags) & MF_BINARY;
a5f8dbb8 439}
145f8fd9 440
b50f1100
VK
441#endif
442
145f8fd9
VK
443
444#endif /* _nms_cscp_h_ */