- User's authentication method now can be configured from console
[public/netxms.git] / src / console / win32 / globals.h
CommitLineData
3bf7e95e
VK
1/*
2** NetXMS - Network Management System
3** Client Library
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: globals.h
21**
22**/
23
24#ifndef _globals_h_
25#define _globals_h_
26
27
28//
29// Application object declaration
30//
31
32class CConsoleApp;
33extern CConsoleApp theApp;
34
35
36//
37// Constants
38//
39
40#define MAX_SERVER_NAME_LEN 64
41#define MAX_LOGIN_NAME_LEN 64
42#define MAX_PASSWORD_LEN 64
89d4d2a2 43#define MAX_INTERFACE_TYPE 32
3036f0b2 44#define MAX_WND_PARAM_LEN 32768
3bf7e95e 45
094b9fa8
VK
46#define TOOLBOX_X_MARGIN 5
47#define TOOLBOX_Y_MARGIN 5
48
52211478
VK
49#define OBJTOOL_MENU_FIRST_ID 4000
50#define OBJTOOL_MENU_LAST_ID 4999
51
f521c96e
VK
52#define NXCON_ALARM_SOUND_KEY _T("Software\\NetXMS\\NetXMS Console\\AlarmSounds")
53
3bf7e95e
VK
54
55//
510f1295
VK
56// Window classes
57//
58
59#define WNDC_LAST_VALUES 1
60#define WNDC_GRAPH 2
61#define WNDC_DCI_DATA 3
62#define WNDC_NETWORK_SUMMARY 4
63#define WNDC_ALARM_BROWSER 5
64#define WNDC_EVENT_BROWSER 6
65#define WNDC_OBJECT_BROWSER 7
23b8cd4f 66#define WNDC_SYSLOG_BROWSER 8
319a91b3 67#define WNDC_TRAP_LOG_BROWSER 9
15952045 68#define WNDC_CONTROL_PANEL 10
510f1295
VK
69
70
71//
bfce8503
VK
72// User interface options
73//
74
75#define UI_OPT_EXPAND_CTRLPANEL 0x0001
76#define UI_OPT_SHOW_GRID 0x0002
77
78
79//
5b7b9f00
VK
80// Other options
81//
82
83#define OPT_MATCH_SERVER_VERSION 0x00010000
8a68ebbd 84#define OPT_DONT_CACHE_OBJECTS 0x00020000
5f743326 85#define OPT_ENCRYPT_CONNECTION 0x00040000
cbcf0362 86#define OPT_CLEAR_OBJECT_CACHE 0x00080000
5b7b9f00
VK
87
88
89//
ef44d5ea
VK
90// Transparent color for images in rule list
91//
92
93#define PSYM_MASK_COLOR RGB(255, 255, 255)
94
95
96//
a5f8f9b0
VK
97// Custom windows messages
98//
99
88cb82cc
VK
100#define NXCM_REQUEST_COMPLETED (WM_USER + 101)
101#define NXCM_CLOSE_STATUS_DLG (WM_USER + 102)
102#define NXCM_OBJECT_CHANGE (WM_USER + 103)
103#define NXCM_FIND_OBJECT (WM_USER + 104)
104#define NXCM_EDITBOX_EVENT (WM_USER + 105)
105#define NXCM_SET_INFO_TEXT (WM_USER + 106)
106#define NXCM_USERDB_CHANGE (WM_USER + 107)
107#define NXCM_STATE_CHANGE (WM_USER + 108)
108#define NXCM_ALARM_UPDATE (WM_USER + 109)
109#define NXCM_POLLER_MESSAGE (WM_USER + 110)
110#define NXCM_START_DEPLOYMENT (WM_USER + 111)
111#define NXCM_DEPLOYMENT_INFO (WM_USER + 112)
112#define NXCM_DEPLOYMENT_FINISHED (WM_USER + 113)
113#define NXCM_GET_SAVE_INFO (WM_USER + 114)
114#define NXCM_TABLE_DATA (WM_USER + 115)
115#define NXCM_NETXMS_EVENT (WM_USER + 116)
116#define NXCM_SYSLOG_RECORD (WM_USER + 117)
117#define NXCM_UPDATE_EVENT_LIST (WM_USER + 118)
118#define NXCM_UPDATE_OBJECT_TOOLS (WM_USER + 119)
119#define NXCM_UPDATE_GRAPH_POINT (WM_USER + 120)
30639d32 120#define NXCM_TRAP_LOG_RECORD (WM_USER + 121)
0e0a5132 121#define NXCM_SUBMAP_CHANGE (WM_USER + 122)
69688776 122#define NXCM_CHANGE_PASSWORD (WM_USER + 123)
f7a7f8e4
VK
123
124
125//
23e62c09
VK
126// Timestamp formats
127//
128
129#define TS_LONG_DATE_TIME 0
130#define TS_LONG_TIME 1
33d061bc
VK
131#define TS_DAY_AND_MONTH 2
132#define TS_MONTH 3
23e62c09
VK
133
134
135//
bfa29136 136// Subdirectories and files in working directory
34870fc0
VK
137//
138
bfa29136
VK
139#define WORKDIR_MIBCACHE _T("\\MIBCache")
140#define WORKDIR_IMAGECACHE _T("\\ImageCache")
43e4e67e 141#define WORKDIR_BKIMAGECACHE _T("\\BkImageCache")
510f1295 142#define WORKFILE_OBJECTCACHE _T("\\objects.cache.")
34870fc0
VK
143
144
145//
a048d988
VK
146// libnxcl object index structure
147//
148
149struct NXC_OBJECT_INDEX
150{
151 DWORD dwKey;
152 NXC_OBJECT *pObject;
153};
154
155
156//
bbf5bbcf
VK
157// Request parameters structure
158//
159
160struct RqData
161{
162 HWND hWnd;
163 DWORD (* pFunc)(...);
164 DWORD dwNumParams;
165 void *pArg1;
166 void *pArg2;
167 void *pArg3;
168 void *pArg4;
169 void *pArg5;
170 void *pArg6;
babb8280 171 void *pArg7;
bbf5bbcf
VK
172};
173
174
175//
34870fc0
VK
176// Code translation structure
177//
178
179struct CODE_TO_TEXT
180{
181 int iCode;
182 char *pszText;
183};
184
185
186//
51bd5a10
VK
187// Default image table
188//
189
190struct DEF_IMG
191{
192 DWORD dwObjectClass;
193 DWORD dwImageId;
2d6e6388 194 int iImageIndex;
51bd5a10
VK
195};
196
197
198//
e063dbf9
VK
199// Package deployment startup info
200//
201
202struct DEPLOYMENT_JOB
203{
204 DWORD dwPkgId;
205 DWORD dwNumObjects;
206 DWORD *pdwObjectList;
207 HWND hWnd;
094b9fa8 208 DWORD *pdwRqId;
e063dbf9
VK
209};
210
211
212//
510f1295
VK
213// Window state saving information
214//
215
216struct WINDOW_SAVE_INFO
217{
218 int iWndClass;
219 WINDOWPLACEMENT placement;
959566bf 220 TCHAR szParameters[MAX_WND_PARAM_LEN];
510f1295
VK
221};
222
223
224//
3036f0b2
VK
225// DCI information
226//
227
228class DCIInfo
229{
230 // Attributes
231public:
232 DWORD m_dwNodeId;
233 DWORD m_dwItemId;
234 int m_iSource;
235 int m_iDataType;
236 TCHAR *m_pszParameter;
237 TCHAR *m_pszDescription;
238
239 // Methods
240public:
241 DCIInfo();
242 DCIInfo(DWORD dwNodeId, NXC_DCI *pItem);
243 ~DCIInfo();
244};
245
246
247//
34870fc0 248// Communication functions
f7a7f8e4
VK
249//
250
31ef156e 251DWORD DoLogin(BOOL bClearCache);
f7a7f8e4
VK
252DWORD DoRequest(DWORD (* pFunc)(void), char *pszInfoText);
253DWORD DoRequestArg1(void *pFunc, void *pArg1, char *pszInfoText);
4925a756 254DWORD DoRequestArg2(void *pFunc, void *pArg1, void *pArg2, char *pszInfoText);
fadbdf37 255DWORD DoRequestArg3(void *pFunc, void *pArg1, void *pArg2, void *pArg3, char *pszInfoText);
933aee5c 256DWORD DoRequestArg4(void *pFunc, void *pArg1, void *pArg2, void *pArg3, void *pArg4, char *pszInfoText);
22c38feb
VK
257DWORD DoRequestArg5(void *pFunc, void *pArg1, void *pArg2, void *pArg3, void *pArg4,
258 void *pArg5, char *pszInfoText);
9f20696e
VK
259DWORD DoRequestArg6(void *pFunc, void *pArg1, void *pArg2, void *pArg3, void *pArg4,
260 void *pArg5, void *pArg6, char *pszInfoText);
babb8280
VK
261DWORD DoRequestArg7(void *pFunc, void *pArg1, void *pArg2, void *pArg3, void *pArg4,
262 void *pArg5, void *pArg6, void *pArg7, char *pszInfoText);
bbf5bbcf 263DWORD WINAPI PollerThread(void *pArg);
a5f8f9b0
VK
264
265
266//
ef44d5ea 267// Drawing functions
946d48b3
VK
268//
269
270void DrawPieChart(CDC &dc, RECT *pRect, int iNumElements, DWORD *pdwValues, COLORREF *pColors);
bb7781ee 271void Draw3dRect(HDC hDC, LPRECT pRect, COLORREF rgbTop, COLORREF rgbBottom);
946d48b3
VK
272
273
274//
2d6e6388 275// Image and image list functions
cea97623
VK
276//
277
cea97623 278void CreateObjectImageList(void);
2d6e6388
VK
279int ImageIdToIndex(DWORD dwImageId);
280int GetObjectImageIndex(NXC_OBJECT *pObject);
baa7b4ee 281int GetClassDefaultImageIndex(int iClass);
2d6e6388
VK
282CImageList *CreateEventImageList(void);
283void LoadBitmapIntoList(CImageList *pImageList, UINT nIDResource, COLORREF rgbMaskColor);
43e4e67e 284HBITMAP LoadPicture(TCHAR *pszFile, int nScaleFactor);
cea97623
VK
285
286
287//
34138f2d
VK
288// MIB functions
289//
290
291void BuildOIDString(SNMP_MIBObject *pNode, char *pszBuffer);
292char *BuildSymbolicOIDString(SNMP_MIBObject *pNode, DWORD dwInstance);
293
294
295//
9f20696e
VK
296// Utility functions
297//
298
23e62c09 299char *FormatTimeStamp(DWORD dwTimeStamp, char *pszBuffer, int iType);
9f20696e 300CSize GetWindowSize(CWnd *pWnd);
34870fc0
VK
301void SelectListViewItem(CListCtrl *pListCtrl, int iItem);
302const char *CodeToText(int iCode, CODE_TO_TEXT *pTranslator, const char *pszDefaultText = "Unknown");
303char *TranslateUNIXText(const char *pszText);
11363a86 304void RestoreMDIChildPlacement(CMDIChildWnd *pWnd, WINDOWPLACEMENT *pwp);
cc2d5b36 305BOOL IsButtonChecked(CDialog *pWnd, int nCtrl);
510f1295 306BOOL ExtractWindowParam(TCHAR *pszStr, TCHAR *pszParam, TCHAR *pszBuffer, int iSize);
2ccaffe5
VK
307long ExtractWindowParamLong(TCHAR *pszStr, TCHAR *pszParam, long nDefault);
308DWORD ExtractWindowParamULong(TCHAR *pszStr, TCHAR *pszParam, DWORD dwDefault);
6b1b7aed 309void CopyMenuItems(CMenu *pDst, CMenu *pSrc);
b9ce1c9d
VK
310TCHAR **CopyStringList(TCHAR **ppList, DWORD dwSize);
311void DestroyStringList(TCHAR **ppList, DWORD dwSize);
eb0a2ef0 312HTREEITEM FindTreeCtrlItem(CTreeCtrl &ctrl, HTREEITEM hRoot, TCHAR *pszText);
269e3aca 313HTREEITEM FindTreeCtrlItemEx(CTreeCtrl &ctrl, HTREEITEM hRoot, DWORD dwData);
34870fc0
VK
314
315
316//
1b282e44
VK
317// Object tools functions
318//
319
320DWORD LoadObjectTools(void);
321CMenu *CreateToolsSubmenu(NXC_OBJECT *pObject, TCHAR *pszCurrPath, DWORD *pdwStart);
322
323
324//
925832ac
VK
325// Action functions
326//
327
328NXC_ACTION *FindActionById(DWORD dwActionId);
8c290af0 329void UpdateActions(DWORD dwCode, NXC_ACTION *pAction);
925832ac
VK
330
331
332//
3bf7e95e
VK
333// Variables
334//
335
babb8280 336extern NXC_SESSION g_hSession;
bfce8503 337extern DWORD g_dwOptions;
6ffe9c6c 338extern DWORD g_dwMaxLogRecords;
cf85ad81
VK
339extern TCHAR g_szServer[];
340extern TCHAR g_szLogin[];
341extern TCHAR g_szPassword[];
cf85ad81 342extern TCHAR g_szWorkDir[];
20a2d19c
VK
343extern TCHAR *g_szStatusText[];
344extern TCHAR *g_szStatusTextSmall[];
345extern TCHAR *g_szActionType[];
346extern TCHAR *g_szServiceType[];
094b9fa8 347extern TCHAR *g_szDeploymentStatus[];
c4096dd8 348extern TCHAR *g_szToolType[];
d3637d82 349extern TCHAR *g_szToolColFmt[];
23b8cd4f
VK
350extern TCHAR *g_szSyslogSeverity[];
351extern TCHAR *g_szSyslogFacility[];
95b6a1b6 352extern TCHAR *g_szAuthMethod[];
6aaf0c07
VK
353extern COLORREF g_statusColorTable[];
354extern char *g_szObjectClass[];
89d4d2a2 355extern char *g_szInterfaceTypes[];
0262502e
VK
356extern TCHAR *g_pszItemOrigin[];
357extern TCHAR *g_pszItemOriginLong[];
358extern TCHAR *g_pszItemDataType[];
1c0c8dde 359extern char *g_pszItemStatus[];
413e21e2 360extern char *g_pszThresholdOperation[];
95838aec 361extern char *g_pszThresholdOperationLong[];
413e21e2 362extern char *g_pszThresholdFunction[];
95838aec 363extern char *g_pszThresholdFunctionLong[];
34870fc0
VK
364extern CODE_TO_TEXT g_ctSnmpMibStatus[];
365extern CODE_TO_TEXT g_ctSnmpMibAccess[];
366extern CODE_TO_TEXT g_ctSnmpMibType[];
f70fc197 367extern NXC_IMAGE_LIST *g_pSrvImageList;
cea97623
VK
368extern CImageList *g_pObjectSmallImageList;
369extern CImageList *g_pObjectNormalImageList;
51bd5a10
VK
370extern DWORD g_dwDefImgListSize;
371extern DEF_IMG *g_pDefImgList;
c7863da1
VK
372extern DWORD g_dwNumActions;
373extern NXC_ACTION *g_pActionList;
374extern HANDLE g_mutexActionListAccess;
6849d9be 375extern NXC_CC_LIST *g_pCCList;
18e26ff8 376extern CODE_TO_TEXT g_ctNodeType[];
52211478
VK
377extern DWORD g_dwNumObjectTools;
378extern NXC_OBJECT_TOOL *g_pObjectToolList;
34138f2d 379extern SNMP_MIBObject *g_pMIBRoot;
f521c96e 380extern ALARM_SOUND_CFG g_soundCfg;
e0e45119 381extern CFont g_fontCode;
c7863da1
VK
382
383
384//
385// Lock/unlock access to action list
386//
387
388inline void LockActions(void)
389{
390 WaitForSingleObject(g_mutexActionListAccess, INFINITE);
391}
392
393inline void UnlockActions(void)
394{
395 ReleaseMutex(g_mutexActionListAccess);
396}
3bf7e95e
VK
397
398#endif