externalized strings in object view plugin
[public/netxms.git] / src / server / include / nms_core.h
CommitLineData
5039dede
AK
1/*
2** NetXMS - Network Management System
6adc4a1a 3** Copyright (C) 2003-2012 Victor Kirhenshtein
5039dede
AK
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** File: nms_core.h
20**
21**/
22
23#ifndef _nms_core_h_
24#define _nms_core_h_
25
26#ifdef _WIN32
27#ifdef NXCORE_EXPORTS
28#define NXCORE_EXPORTABLE __declspec(dllexport)
29#else
30#define NXCORE_EXPORTABLE __declspec(dllimport)
31#endif
32#else /* _WIN32 */
33#define NXCORE_EXPORTABLE
34#endif
35
36#define LIBNXCL_NO_DECLARATIONS 1
37
38#include <nms_common.h>
39
40#ifndef _WIN32
41
42#if HAVE_SYS_TYPES_H
43# include <sys/types.h>
44#endif
45
46#if HAVE_DLFCN_H
47#include <dlfcn.h>
48#endif
49
50#define WSAGetLastError() (errno)
51
52#endif /* _WIN32 */
53
54#include <time.h>
55#include <stdio.h>
56#include <string.h>
57#include <stdarg.h>
58
958a9397
VK
59#ifdef _WITH_ENCRYPTION
60#include <openssl/ssl.h>
61#endif
62
5039dede
AK
63#define SHOW_FLAG_VALUE(x) _T(" %-32s = %d\n"), _T(#x), (g_dwFlags & x) ? 1 : 0
64
65
66//
67// Common includes
68//
69
70#include <nms_util.h>
71#include <dbdrv.h>
72#include <nms_cscp.h>
73#include <uuid.h>
74#include <nxsrvapi.h>
5039dede
AK
75#include <nxqueue.h>
76#include <nxsnmp.h>
77#include <nxmodule.h>
78#include <nxsl.h>
9d88cdc9 79#include <nxdbapi.h>
9796ce45 80#include <nddrv.h>
d41edbd3 81#include <nxcore_smclp.h>
5039dede 82
46ee6286
VK
83/**
84 * Console context
85 */
5039dede
AK
86struct __console_ctx
87{
88 SOCKET hSocket;
d3a7cf4c 89 MUTEX socketMutex;
5039dede 90 CSCPMessage *pMsg;
200d662d 91 ClientSession *session;
5039dede
AK
92};
93
94typedef __console_ctx * CONSOLE_CTX;
95
2bac37f9
VK
96/**
97 * Server includes
98 */
5039dede
AK
99#include "nms_dcoll.h"
100#include "nms_users.h"
46ee6286 101#include "nxcore_winperf.h"
5039dede 102#include "nms_objects.h"
5039dede
AK
103#include "nms_locks.h"
104#include "nms_pkg.h"
105#include "nms_topo.h"
106#include "nms_script.h"
5039dede 107#include "nxcore_situations.h"
ab621f39 108#include "nxcore_jobs.h"
e05b1945 109#include "nxcore_logs.h"
5039dede 110
2bac37f9
VK
111/**
112 * Common constants and macros
113 */
73869331 114#define MAX_LINE_SIZE 4096
967893bb 115#define GROUP_FLAG_BIT ((UINT32)0x80000000)
73869331
VK
116#define CHECKPOINT_SNMP_PORT 260
117#define DEFAULT_AFFINITY_MASK 0xFFFFFFFF
5039dede
AK
118
119typedef void * HSNMPSESSION;
120
0f506caa
VK
121/**
122 * Prefixes for poller messages
123 */
df8a4ca2
VK
124#define POLLER_ERROR _T("\x7F") _T("e")
125#define POLLER_WARNING _T("\x7Fw")
126#define POLLER_INFO _T("\x7Fi")
127
0f506caa
VK
128/**
129 * Unique identifier group codes
130 */
5039dede
AK
131#define IDG_NETWORK_OBJECT 0
132#define IDG_CONTAINER_CAT 1
133#define IDG_EVENT 2
134#define IDG_ITEM 3
135#define IDG_SNMP_TRAP 4
24dc5346 136#define IDG_JOB 5
5039dede
AK
137#define IDG_ACTION 6
138#define IDG_EVENT_GROUP 7
139#define IDG_THRESHOLD 8
140#define IDG_USER 9
141#define IDG_USER_GROUP 10
142#define IDG_ALARM 11
143#define IDG_ALARM_NOTE 12
144#define IDG_PACKAGE 13
636e0c72 145#define IDG_SLM_TICKET 14
5039dede
AK
146#define IDG_OBJECT_TOOL 15
147#define IDG_SCRIPT 16
148#define IDG_AGENT_CONFIG 17
149#define IDG_GRAPH 18
150#define IDG_CERTIFICATE 19
151#define IDG_SITUATION 20
ba89fed2 152#define IDG_DCT_COLUMN 21
0f506caa 153#define IDG_MAPPING_TABLE 22
b4c2a628 154#define IDG_DCI_SUMMARY_TABLE 23
5039dede 155
0f506caa
VK
156/**
157 * Exit codes for console commands
158 */
5039dede
AK
159#define CMD_EXIT_CONTINUE 0
160#define CMD_EXIT_CLOSE_SESSION 1
161#define CMD_EXIT_SHUTDOWN 2
162
0f506caa
VK
163/**
164 * Network discovery mode
165 */
5039dede
AK
166#define DISCOVERY_DISABLED 0
167#define DISCOVERY_PASSIVE_ONLY 1
168#define DISCOVERY_ACTIVE 2
169
0f506caa
VK
170/**
171 * Client session flags
172 */
967893bb
VK
173#define CSF_EPP_LOCKED ((UINT32)0x0002)
174#define CSF_PACKAGE_DB_LOCKED ((UINT32)0x0004)
175#define CSF_USER_DB_LOCKED ((UINT32)0x0008)
176#define CSF_EPP_UPLOAD ((UINT32)0x0010)
177#define CSF_CONSOLE_OPEN ((UINT32)0x0020)
178#define CSF_AUTHENTICATED ((UINT32)0x0080)
179#define CSF_RECEIVING_MAP_DATA ((UINT32)0x0200)
180#define CSF_SYNC_OBJECT_COMMENTS ((UINT32)0x0400)
5039dede 181
0f506caa
VK
182/**
183 * Client session states
184 */
5039dede
AK
185#define SESSION_STATE_INIT 0
186#define SESSION_STATE_IDLE 1
187#define SESSION_STATE_PROCESSING 2
188
0f506caa
VK
189/**
190 * Information categories for UPDATE_INFO structure
191 */
5039dede
AK
192#define INFO_CAT_EVENT 1
193#define INFO_CAT_OBJECT_CHANGE 2
194#define INFO_CAT_ALARM 3
195#define INFO_CAT_ACTION 4
196#define INFO_CAT_SYSLOG_MSG 5
197#define INFO_CAT_SNMP_TRAP 6
198#define INFO_CAT_AUDIT_RECORD 7
199#define INFO_CAT_SITUATION 8
624f1165 200#define INFO_CAT_LIBRARY_IMAGE 9
5039dede 201
0f506caa
VK
202/**
203 * Certificate types
204 */
5039dede
AK
205#define CERT_TYPE_TRUSTED_CA 0
206#define CERT_TYPE_USER 1
207
0f506caa
VK
208/**
209 * Audit subsystems
210 */
5039dede
AK
211#define AUDIT_SECURITY _T("SECURITY")
212#define AUDIT_OBJECTS _T("OBJECTS")
213#define AUDIT_SYSCFG _T("SYSCFG")
214#define AUDIT_CONSOLE _T("CONSOLE")
215
0f506caa
VK
216/**
217 * Event handling subsystem definitions
218 */
5039dede
AK
219#include "nms_events.h"
220#include "nms_actions.h"
221#include "nms_alarm.h"
222
0f506caa
VK
223/**
224 * New node information
225 */
5039dede
AK
226typedef struct
227{
967893bb
VK
228 UINT32 dwIpAddr;
229 UINT32 dwNetMask;
230 UINT32 zoneId;
5039dede 231 BOOL ignoreFilter;
baa5324c 232 BYTE bMacAddr[MAC_ADDR_LENGTH];
5039dede
AK
233} NEW_NODE;
234
0f506caa
VK
235/**
236 * New node flags
237 */
5039dede
AK
238#define NNF_IS_SNMP 0x0001
239#define NNF_IS_AGENT 0x0002
240#define NNF_IS_ROUTER 0x0004
241#define NNF_IS_BRIDGE 0x0008
242#define NNF_IS_PRINTER 0x0010
243#define NNF_IS_CDP 0x0020
244#define NNF_IS_SONMP 0x0040
245#define NNF_IS_LLDP 0x0080
246
0f506caa
VK
247/**
248 * Node information for autodiscovery filter
249 */
5039dede
AK
250typedef struct
251{
967893bb
VK
252 UINT32 dwIpAddr;
253 UINT32 dwNetMask;
254 UINT32 dwSubnetAddr;
255 UINT32 dwFlags;
5039dede 256 int nSNMPVersion;
35f836fe
VK
257 TCHAR szObjectId[MAX_OID_LEN * 4]; // SNMP OID
258 TCHAR szAgentVersion[MAX_AGENT_VERSION_LEN];
259 TCHAR szPlatform[MAX_PLATFORM_NAME_LEN];
5039dede
AK
260} DISCOVERY_FILTER_DATA;
261
0f506caa
VK
262/**
263 * Data update structure for client sessions
264 */
5039dede
AK
265typedef struct
266{
967893bb
VK
267 UINT32 dwCategory; // Data category - event, network object, etc.
268 UINT32 dwCode; // Data-specific update code
5039dede
AK
269 void *pData; // Pointer to data block
270} UPDATE_INFO;
271
72f6ece2 272
534e1b83
VK
273/**
274 * Extended agent connection
275 */
5039dede
AK
276class AgentConnectionEx : public AgentConnection
277{
278protected:
967893bb 279 UINT32 m_nodeId;
d1c1c522 280
f480bdd4
VK
281 virtual void onTrap(CSCPMessage *msg);
282 virtual void onDataPush(CSCPMessage *msg);
5039dede
AK
283
284public:
967893bb 285 AgentConnectionEx(UINT32 nodeId, UINT32 ipAddr, WORD wPort = AGENT_LISTEN_PORT,
5039dede 286 int iAuthMethod = AUTH_NONE, TCHAR *pszSecret = NULL) :
d1c1c522 287 AgentConnection(ipAddr, wPort, iAuthMethod, pszSecret) { m_nodeId = nodeId; }
5039dede 288 virtual ~AgentConnectionEx();
45d84f8a 289
967893bb
VK
290 UINT32 deployPolicy(AgentPolicy *policy);
291 UINT32 uninstallPolicy(AgentPolicy *policy);
5039dede
AK
292};
293
534e1b83
VK
294/**
295 * Mobile device session
296 */
297class NXCORE_EXPORTABLE MobileDeviceSession
298{
299private:
300 SOCKET m_hSocket;
301 Queue *m_pSendQueue;
302 Queue *m_pMessageQueue;
967893bb 303 UINT32 m_dwIndex;
534e1b83
VK
304 int m_iState;
305 WORD m_wCurrentCmd;
967893bb
VK
306 UINT32 m_dwUserId;
307 UINT32 m_deviceObjectId;
534e1b83
VK
308 CSCP_BUFFER *m_pMsgBuffer;
309 NXCPEncryptionContext *m_pCtx;
310 BYTE m_challenge[CLIENT_CHALLENGE_SIZE];
311 THREAD m_hWriteThread;
312 THREAD m_hProcessingThread;
313 MUTEX m_mutexSocketWrite;
314 struct sockaddr *m_clientAddr;
315 TCHAR m_szHostName[256]; // IP address of name of conneced host in textual form
316 TCHAR m_szUserName[MAX_SESSION_NAME]; // String in form login_name@host
317 TCHAR m_szClientInfo[96]; // Client app info string
967893bb
VK
318 UINT32 m_dwEncryptionRqId;
319 UINT32 m_dwEncryptionResult;
534e1b83 320 CONDITION m_condEncryptionSetup;
967893bb 321 UINT32 m_dwRefCount;
534e1b83
VK
322 bool m_isAuthenticated;
323
324 static THREAD_RESULT THREAD_CALL readThreadStarter(void *);
325 static THREAD_RESULT THREAD_CALL writeThreadStarter(void *);
326 static THREAD_RESULT THREAD_CALL processingThreadStarter(void *);
5039dede 327
534e1b83
VK
328 void readThread();
329 void writeThread();
330 void processingThread();
331
332 void setupEncryption(CSCPMessage *request);
967893bb 333 void respondToKeepalive(UINT32 dwRqId);
534e1b83 334 void debugPrintf(int level, const TCHAR *format, ...);
967893bb 335 void sendServerInfo(UINT32 dwRqId);
534e1b83
VK
336 void login(CSCPMessage *pRequest);
337 void updateDeviceInfo(CSCPMessage *pRequest);
338 void updateDeviceStatus(CSCPMessage *pRequest);
339
340public:
341 MobileDeviceSession(SOCKET hSocket, struct sockaddr *addr);
342 ~MobileDeviceSession();
343
344 void incRefCount() { m_dwRefCount++; }
345 void decRefCount() { if (m_dwRefCount > 0) m_dwRefCount--; }
346
347 void run();
348
349 void postMessage(CSCPMessage *pMsg) { m_pSendQueue->Put(pMsg->CreateMessage()); }
350 void sendMessage(CSCPMessage *pMsg);
5039dede 351
967893bb
VK
352 UINT32 getIndex() { return m_dwIndex; }
353 void setIndex(UINT32 dwIndex) { if (m_dwIndex == INVALID_INDEX) m_dwIndex = dwIndex; }
534e1b83
VK
354 int getState() { return m_iState; }
355 const TCHAR *getUserName() { return m_szUserName; }
356 const TCHAR *getClientInfo() { return m_szClientInfo; }
357 const TCHAR *getHostName() { return m_szHostName; }
967893bb 358 UINT32 getUserId() { return m_dwUserId; }
534e1b83
VK
359 bool isAuthenticated() { return m_isAuthenticated; }
360 WORD getCurrentCmd() { return m_wCurrentCmd; }
361 int getCipher() { return (m_pCtx == NULL) ? -1 : m_pCtx->getCipher(); }
362};
363
364/**
365 * Client (user) session
366 */
5039dede
AK
367#define DECLARE_THREAD_STARTER(func) static THREAD_RESULT THREAD_CALL ThreadStarter_##func(void *);
368
a0e3917e 369class NXCORE_EXPORTABLE ClientSession
5039dede
AK
370{
371private:
372 SOCKET m_hSocket;
373 Queue *m_pSendQueue;
374 Queue *m_pMessageQueue;
375 Queue *m_pUpdateQueue;
967893bb 376 UINT32 m_dwIndex;
5039dede
AK
377 int m_iState;
378 WORD m_wCurrentCmd;
967893bb
VK
379 UINT32 m_dwUserId;
380 UINT32 m_dwSystemAccess; // User's system access rights
381 UINT32 m_dwFlags; // Session flags
f8c6f10f 382 int m_clientType; // Client system type - desktop, web, mobile, etc.
5039dede 383 CSCP_BUFFER *m_pMsgBuffer;
98abc9f1 384 NXCPEncryptionContext *m_pCtx;
5039dede
AK
385 BYTE m_challenge[CLIENT_CHALLENGE_SIZE];
386 THREAD m_hWriteThread;
387 THREAD m_hProcessingThread;
388 THREAD m_hUpdateThread;
d3a7cf4c 389 MUTEX m_mutexSocketWrite;
5039dede
AK
390 MUTEX m_mutexSendEvents;
391 MUTEX m_mutexSendSyslog;
392 MUTEX m_mutexSendTrapLog;
393 MUTEX m_mutexSendObjects;
394 MUTEX m_mutexSendAlarms;
395 MUTEX m_mutexSendActions;
396 MUTEX m_mutexSendAuditLog;
397 MUTEX m_mutexSendSituations;
398 MUTEX m_mutexPollerInit;
60557d06 399 struct sockaddr *m_clientAddr;
91f6b72c
VK
400 TCHAR m_workstation[256]; // IP address or name of connected host in textual form
401 TCHAR m_webServerAddress[256]; // IP address or name of web server for web sessions
5039dede
AK
402 TCHAR m_szUserName[MAX_SESSION_NAME]; // String in form login_name@host
403 TCHAR m_szClientInfo[96]; // Client app info string
a51628e2 404 time_t m_loginTime;
967893bb
VK
405 UINT32 m_dwOpenDCIListSize; // Number of open DCI lists
406 UINT32 *m_pOpenDCIList; // List of nodes with DCI lists open
407 UINT32 m_dwNumRecordsToUpload; // Number of records to be uploaded
408 UINT32 m_dwRecordsUploaded;
5039dede
AK
409 EPRule **m_ppEPPRuleList; // List of loaded EPP rules
410 int m_hCurrFile;
967893bb
VK
411 UINT32 m_dwFileRqId;
412 UINT32 m_dwUploadCommand;
413 UINT32 m_dwUploadData;
e928a6db 414 uuid_t m_uploadImageGuid;
5039dede 415 TCHAR m_szCurrFileName[MAX_PATH];
967893bb
VK
416 UINT32 m_dwRefCount;
417 UINT32 m_dwEncryptionRqId;
418 UINT32 m_dwEncryptionResult;
5039dede 419 CONDITION m_condEncryptionSetup;
967893bb 420 UINT32 m_dwActiveChannels; // Active data channels
200d662d 421 CONSOLE_CTX m_console; // Server console context
5039dede 422
534e1b83
VK
423 static THREAD_RESULT THREAD_CALL readThreadStarter(void *);
424 static THREAD_RESULT THREAD_CALL writeThreadStarter(void *);
425 static THREAD_RESULT THREAD_CALL processingThreadStarter(void *);
426 static THREAD_RESULT THREAD_CALL updateThreadStarter(void *);
427 static THREAD_RESULT THREAD_CALL pollerThreadStarter(void *);
5039dede 428
92c51b1d
VK
429 DECLARE_THREAD_STARTER(getCollectedData)
430 DECLARE_THREAD_STARTER(getTableCollectedData)
431 DECLARE_THREAD_STARTER(clearDCIData)
adac28be
VK
432 DECLARE_THREAD_STARTER(queryParameter)
433 DECLARE_THREAD_STARTER(queryAgentTable)
84880c89 434 DECLARE_THREAD_STARTER(queryL2Topology)
b1e9b6b3
VK
435 DECLARE_THREAD_STARTER(sendEventLog)
436 DECLARE_THREAD_STARTER(sendSyslog)
1da08bc6
VK
437 DECLARE_THREAD_STARTER(createObject)
438 DECLARE_THREAD_STARTER(getServerFile)
6f16f12d 439 DECLARE_THREAD_STARTER(getAgentFile)
e05b1945
VK
440 DECLARE_THREAD_STARTER(queryServerLog)
441 DECLARE_THREAD_STARTER(getServerLogQueryData)
e31c8e60 442 DECLARE_THREAD_STARTER(executeAction)
630e15d6 443 DECLARE_THREAD_STARTER(findNodeConnection)
06a93345 444 DECLARE_THREAD_STARTER(findMacAddress)
80e0db05 445 DECLARE_THREAD_STARTER(findIpAddress)
200d662d 446 DECLARE_THREAD_STARTER(processConsoleCommand)
b08d31f4 447 DECLARE_THREAD_STARTER(sendMib)
e12e1422 448 DECLARE_THREAD_STARTER(getReportResults)
3932fde6 449 DECLARE_THREAD_STARTER(deleteReportResults)
e12e1422 450 DECLARE_THREAD_STARTER(renderReport)
6d069676 451 DECLARE_THREAD_STARTER(getNetworkPath)
2bac37f9 452 DECLARE_THREAD_STARTER(getAlarmEvents)
d75003e1 453 DECLARE_THREAD_STARTER(forwardToReportingServer)
5039dede 454
62768df3
VK
455 void readThread();
456 void writeThread();
457 void processingThread();
458 void updateThread();
967893bb 459 void pollerThread(Node *pNode, int iPollType, UINT32 dwRqId);
5039dede 460
9e9d631e 461 void setupEncryption(CSCPMessage *request);
967893bb 462 void respondToKeepalive(UINT32 dwRqId);
e05b1945 463 void onFileUpload(BOOL bSuccess);
534e1b83 464 void debugPrintf(int level, const TCHAR *format, ...);
967893bb 465 void sendServerInfo(UINT32 dwRqId);
711e5e9a 466 void login(CSCPMessage *pRequest);
62768df3
VK
467 void sendAllObjects(CSCPMessage *pRequest);
468 void sendSelectedObjects(CSCPMessage *pRequest);
b1e9b6b3 469 void sendEventLog(CSCPMessage *pRequest);
967893bb 470 void sendAllConfigVars(UINT32 dwRqId);
b1e9b6b3
VK
471 void setConfigVariable(CSCPMessage *pRequest);
472 void deleteConfigVariable(CSCPMessage *pRequest);
967893bb
VK
473 void sendUserDB(UINT32 dwRqId);
474 void sendAllAlarms(UINT32 dwRqId);
b1e9b6b3
VK
475 void createUser(CSCPMessage *pRequest);
476 void updateUser(CSCPMessage *pRequest);
477 void deleteUser(CSCPMessage *pRequest);
478 void setPassword(CSCPMessage *pRequest);
967893bb
VK
479 void lockUserDB(UINT32 dwRqId, BOOL bLock);
480 void sendEventDB(UINT32 dwRqId);
8eb2d92b
VK
481 void modifyEventTemplate(CSCPMessage *pRequest);
482 void deleteEventTemplate(CSCPMessage *pRequest);
967893bb 483 void generateEventCode(UINT32 dwRqId);
92c51b1d 484 void modifyObject(CSCPMessage *pRequest);
1da08bc6 485 void changeObjectMgmtStatus(CSCPMessage *pRequest);
92c51b1d
VK
486 void openNodeDCIList(CSCPMessage *pRequest);
487 void closeNodeDCIList(CSCPMessage *pRequest);
488 void modifyNodeDCI(CSCPMessage *pRequest);
489 void copyDCI(CSCPMessage *pRequest);
490 void applyTemplate(CSCPMessage *pRequest);
491 void getCollectedData(CSCPMessage *pRequest);
492 void getTableCollectedData(CSCPMessage *pRequest);
6fd6de0a 493 bool getCollectedDataFromDB(CSCPMessage *request, CSCPMessage *response, DataCollectionTarget *object, int dciType);
92c51b1d
VK
494 void clearDCIData(CSCPMessage *pRequest);
495 void changeDCIStatus(CSCPMessage *pRequest);
b9a8e081
VK
496 void getLastValues(CSCPMessage *pRequest);
497 void getTableLastValues(CSCPMessage *pRequest);
711e5e9a 498 void getThresholdSummary(CSCPMessage *request);
c9630390 499 void openEPP(CSCPMessage *request);
967893bb 500 void closeEPP(UINT32 dwRqId);
92c51b1d
VK
501 void saveEPP(CSCPMessage *pRequest);
502 void processEPPRecord(CSCPMessage *pRequest);
967893bb 503 void sendMIBTimestamp(UINT32 dwRqId);
b08d31f4 504 void sendMib(CSCPMessage *request);
b1e9b6b3
VK
505 void createObject(CSCPMessage *request);
506 void changeObjectBinding(CSCPMessage *request, BOOL bBind);
507 void deleteObject(CSCPMessage *request);
508 void getAlarm(CSCPMessage *request);
509 void getAlarmEvents(CSCPMessage *request);
510 void acknowledgeAlarm(CSCPMessage *request);
511 void resolveAlarm(CSCPMessage *request, bool terminate);
512 void deleteAlarm(CSCPMessage *request);
1b94acbf
VK
513 void getAlarmNotes(CSCPMessage *pRequest);
514 void updateAlarmNote(CSCPMessage *pRequest);
515 void createAction(CSCPMessage *pRequest);
516 void updateAction(CSCPMessage *pRequest);
517 void deleteAction(CSCPMessage *pRequest);
967893bb
VK
518 void sendAllActions(UINT32 dwRqId);
519 void SendContainerCategories(UINT32 dwRqId);
92c51b1d 520 void forcedNodePoll(CSCPMessage *pRequest);
b1e9b6b3
VK
521 void onTrap(CSCPMessage *pRequest);
522 void onWakeUpNode(CSCPMessage *pRequest);
adac28be
VK
523 void queryParameter(CSCPMessage *pRequest);
524 void queryAgentTable(CSCPMessage *pRequest);
fdbee7f8 525 void editTrap(int iOperation, CSCPMessage *pRequest);
967893bb
VK
526 void LockTrapCfg(UINT32 dwRqId, BOOL bLock);
527 void sendAllTraps(UINT32 dwRqId);
528 void sendAllTraps2(UINT32 dwRqId);
529 void LockPackageDB(UINT32 dwRqId, BOOL bLock);
530 void SendAllPackages(UINT32 dwRqId);
5039dede
AK
531 void InstallPackage(CSCPMessage *pRequest);
532 void RemovePackage(CSCPMessage *pRequest);
533 void DeployPackage(CSCPMessage *pRequest);
074498ac 534 void getParametersList(CSCPMessage *pRequest);
fdbee7f8
VK
535 void getUserVariable(CSCPMessage *pRequest);
536 void setUserVariable(CSCPMessage *pRequest);
537 void copyUserVariable(CSCPMessage *pRequest);
538 void enumUserVariables(CSCPMessage *pRequest);
539 void deleteUserVariable(CSCPMessage *pRequest);
4c789f9e 540 void changeObjectZone(CSCPMessage *pRequest);
92c51b1d
VK
541 void getAgentConfig(CSCPMessage *pRequest);
542 void updateAgentConfig(CSCPMessage *pRequest);
e31c8e60 543 void executeAction(CSCPMessage *pRequest);
967893bb 544 void sendObjectTools(UINT32 dwRqId);
0e950f45
VK
545 void sendObjectToolDetails(CSCPMessage *pRequest);
546 void updateObjectTool(CSCPMessage *pRequest);
547 void deleteObjectTool(CSCPMessage *pRequest);
967893bb 548 void generateObjectToolId(UINT32 dwRqId);
0e950f45 549 void execTableTool(CSCPMessage *pRequest);
b1e9b6b3
VK
550 void changeSubscription(CSCPMessage *pRequest);
551 void sendSyslog(CSCPMessage *pRequest);
967893bb
VK
552 void sendServerStats(UINT32 dwRqId);
553 void sendScriptList(UINT32 dwRqId);
0c7aca90
VK
554 void sendScript(CSCPMessage *pRequest);
555 void updateScript(CSCPMessage *pRequest);
556 void renameScript(CSCPMessage *pRequest);
557 void deleteScript(CSCPMessage *pRequest);
967893bb 558 void SendSessionList(UINT32 dwRqId);
5039dede
AK
559 void KillSession(CSCPMessage *pRequest);
560 void SendTrapLog(CSCPMessage *pRequest);
561 void StartSnmpWalk(CSCPMessage *pRequest);
241c2740 562 void resolveDCINames(CSCPMessage *pRequest);
967893bb 563 UINT32 resolveDCIName(UINT32 dwNode, UINT32 dwItem, TCHAR **ppszName);
5039dede 564 void SendConfigForAgent(CSCPMessage *pRequest);
967893bb 565 void sendAgentCfgList(UINT32 dwRqId);
5039dede
AK
566 void OpenAgentConfig(CSCPMessage *pRequest);
567 void SaveAgentConfig(CSCPMessage *pRequest);
568 void DeleteAgentConfig(CSCPMessage *pRequest);
569 void SwapAgentConfigs(CSCPMessage *pRequest);
570 void SendObjectComments(CSCPMessage *pRequest);
6fd6de0a
VK
571 void updateObjectComments(CSCPMessage *pRequest);
572 void pushDCIData(CSCPMessage *pRequest);
573 void getAddrList(CSCPMessage *pRequest);
574 void setAddrList(CSCPMessage *pRequest);
92c51b1d 575 void resetComponent(CSCPMessage *pRequest);
7a46028e 576 void sendDCIEventList(CSCPMessage *request);
5039dede 577 void SendDCIInfo(CSCPMessage *pRequest);
74526d25 578 void sendPerfTabDCIList(CSCPMessage *pRequest);
a7ff20a5
VK
579 void exportConfiguration(CSCPMessage *pRequest);
580 void importConfiguration(CSCPMessage *pRequest);
967893bb 581 void SendGraphList(UINT32 dwRqId);
5039dede
AK
582 void DefineGraph(CSCPMessage *pRequest);
583 void DeleteGraph(CSCPMessage *pRequest);
584 void AddCACertificate(CSCPMessage *pRequest);
585 void DeleteCertificate(CSCPMessage *pRequest);
586 void UpdateCertificateComments(CSCPMessage *pRequest);
967893bb 587 void getCertificateList(UINT32 dwRqId);
84880c89 588 void queryL2Topology(CSCPMessage *pRequest);
b1e9b6b3 589 void sendSMS(CSCPMessage *pRequest);
967893bb 590 void SendCommunityList(UINT32 dwRqId);
5039dede 591 void UpdateCommunityList(CSCPMessage *pRequest);
a882b714
VK
592 void getSituationList(UINT32 dwRqId);
593 void createSituation(CSCPMessage *pRequest);
594 void updateSituation(CSCPMessage *pRequest);
595 void deleteSituation(CSCPMessage *pRequest);
596 void deleteSituationInstance(CSCPMessage *pRequest);
1da08bc6
VK
597 void setConfigCLOB(CSCPMessage *pRequest);
598 void getConfigCLOB(CSCPMessage *pRequest);
1da08bc6
VK
599 void registerAgent(CSCPMessage *pRequest);
600 void getServerFile(CSCPMessage *pRequest);
6f16f12d 601 void getAgentFile(CSCPMessage *pRequest);
1da08bc6 602 void testDCITransformation(CSCPMessage *pRequest);
967893bb 603 void sendJobList(UINT32 dwRqId);
45d84f8a 604 void cancelJob(CSCPMessage *pRequest);
8d9f7450
VK
605 void holdJob(CSCPMessage *pRequest);
606 void unholdJob(CSCPMessage *pRequest);
93599cfd 607 void deployAgentPolicy(CSCPMessage *pRequest, bool uninstallFlag);
d83dc1f0
VK
608 void getUserCustomAttribute(CSCPMessage *request);
609 void setUserCustomAttribute(CSCPMessage *request);
e05b1945
VK
610 void openServerLog(CSCPMessage *request);
611 void closeServerLog(CSCPMessage *request);
612 void queryServerLog(CSCPMessage *request);
613 void getServerLogQueryData(CSCPMessage *request);
967893bb 614 void sendUsmCredentials(UINT32 dwRqId);
df8a4ca2 615 void updateUsmCredentials(CSCPMessage *pRequest);
071fd171 616 void sendDCIThresholds(CSCPMessage *request);
1da08bc6 617 void addClusterNode(CSCPMessage *request);
630e15d6 618 void findNodeConnection(CSCPMessage *request);
06a93345 619 void findMacAddress(CSCPMessage *request);
80e0db05 620 void findIpAddress(CSCPMessage *request);
e6b9439a
AK
621 void sendLibraryImage(CSCPMessage *request);
622 void updateLibraryImage(CSCPMessage *request);
623 void listLibraryImages(CSCPMessage *request);
624 void deleteLibraryImage(CSCPMessage *request);
f69c6203 625 void executeServerCommand(CSCPMessage *request);
619e5c9b 626 void uploadFileToAgent(CSCPMessage *request);
1a5e0c22 627 void listServerFileStore(CSCPMessage *request);
200d662d 628 void processConsoleCommand(CSCPMessage *msg);
967893bb
VK
629 void openConsole(UINT32 rqId);
630 void closeConsole(UINT32 rqId);
7f632dfe 631 void getVlans(CSCPMessage *msg);
68f898c9
VK
632 void receiveFile(CSCPMessage *request);
633 void deleteFile(CSCPMessage *request);
8c5b6ed3
VK
634 void executeReport(CSCPMessage *msg);
635 void getReportResults(CSCPMessage *msg);
3932fde6 636 void deleteReportResults(CSCPMessage *msg);
e12e1422 637 void renderReport(CSCPMessage *request);
6d069676 638 void getNetworkPath(CSCPMessage *request);
8836184f 639 void getNodeComponents(CSCPMessage *request);
caa04e26 640 void getNodeSoftware(CSCPMessage *request);
46ee6286 641 void getWinPerfObjects(CSCPMessage *request);
fdbee7f8
VK
642 void listMappingTables(CSCPMessage *request);
643 void getMappingTable(CSCPMessage *request);
644 void updateMappingTable(CSCPMessage *request);
645 void deleteMappingTable(CSCPMessage *request);
d5de1d1d 646 void getWirelessStations(CSCPMessage *request);
967893bb 647 void getSummaryTables(UINT32 rqId);
b4c2a628
VK
648 void getSummaryTableDetails(CSCPMessage *request);
649 void modifySummaryTable(CSCPMessage *request);
650 void deleteSummaryTable(CSCPMessage *request);
651 void querySummaryTable(CSCPMessage *request);
d75003e1 652 void forwardToReportingServer(CSCPMessage *request);
5039dede
AK
653
654public:
60557d06 655 ClientSession(SOCKET hSocket, struct sockaddr *addr);
5039dede
AK
656 ~ClientSession();
657
e05b1945
VK
658 void incRefCount() { m_dwRefCount++; }
659 void decRefCount() { if (m_dwRefCount > 0) m_dwRefCount--; }
660
661 void run();
662
d3a7cf4c
VK
663 void postMessage(CSCPMessage *pMsg) { m_pSendQueue->Put(pMsg->CreateMessage()); }
664 void sendMessage(CSCPMessage *pMsg);
92c51b1d 665 void sendRawMessage(CSCP_MESSAGE *pMsg);
967893bb
VK
666 void sendPollerMsg(UINT32 dwRqId, const TCHAR *pszMsg);
667 BOOL sendFile(const TCHAR *file, UINT32 dwRqId);
e05b1945 668
967893bb
VK
669 UINT32 getIndex() { return m_dwIndex; }
670 void setIndex(UINT32 dwIndex) { if (m_dwIndex == INVALID_INDEX) m_dwIndex = dwIndex; }
f669df41 671 int getState() { return m_iState; }
889d7ff7
VK
672 const TCHAR *getUserName() { return m_szUserName; }
673 const TCHAR *getClientInfo() { return m_szClientInfo; }
91f6b72c
VK
674 const TCHAR *getWorkstation() { return m_workstation; }
675 const TCHAR *getWebServerAddress() { return m_webServerAddress; }
967893bb
VK
676 UINT32 getUserId() { return m_dwUserId; }
677 UINT32 getSystemRights() { return m_dwSystemAccess; }
f669df41
VK
678 bool isAuthenticated() { return (m_dwFlags & CSF_AUTHENTICATED) ? true : false; }
679 bool isConsoleOpen() { return (m_dwFlags & CSF_CONSOLE_OPEN) ? true : false; }
967893bb 680 bool isSubscribed(UINT32 dwChannel) { return (m_dwActiveChannels & dwChannel) ? true : false; }
f669df41 681 WORD getCurrentCmd() { return m_wCurrentCmd; }
98abc9f1 682 int getCipher() { return (m_pCtx == NULL) ? -1 : m_pCtx->getCipher(); }
f8c6f10f 683 int getClientType() { return m_clientType; }
a51628e2 684 time_t getLoginTime() { return m_loginTime; }
e05b1945 685
967893bb 686 bool checkSysAccessRights(UINT32 requiredAccess)
e05b1945 687 {
badf9a95
VK
688 return (m_dwUserId == 0) ? true :
689 ((requiredAccess & m_dwSystemAccess) == requiredAccess);
e05b1945
VK
690 }
691
f669df41 692 void kill();
967893bb 693 void notify(UINT32 dwCode, UINT32 dwData = 0);
e05b1945
VK
694
695 void queueUpdate(UPDATE_INFO *pUpdate) { m_pUpdateQueue->Put(pUpdate); }
696 void onNewEvent(Event *pEvent);
e0f99bf0 697 void onSyslogMessage(NX_SYSLOG_RECORD *pRec);
e05b1945
VK
698 void onNewSNMPTrap(CSCPMessage *pMsg);
699 void onObjectChange(NetObj *pObject);
967893bb
VK
700 void onUserDBUpdate(int code, UINT32 id, UserDatabaseObject *user);
701 void onAlarmUpdate(UINT32 dwCode, NXC_ALARM *pAlarm);
702 void onActionDBUpdate(UINT32 dwCode, NXC_ACTION *pAction);
72f6ece2
AK
703 void onSituationChange(CSCPMessage *msg);
704 void onLibraryImageChange(uuid_t *guid, bool removed = false);
5039dede
AK
705};
706
2bac37f9
VK
707/**
708 * Delayed SQL request
709 */
7dad92fb
VK
710typedef struct
711{
712 TCHAR *query;
713 int bindCount;
714 BYTE *sqlTypes;
715 TCHAR *bindings[1]; /* actual size determined by bindCount field */
716} DELAYED_SQL_REQUEST;
717
2bac37f9
VK
718/**
719 * Delayed request for idata_ INSERT
720 */
f68d9eac
VK
721typedef struct
722{
723 time_t timestamp;
967893bb
VK
724 UINT32 nodeId;
725 UINT32 dciId;
f68d9eac
VK
726 TCHAR value[MAX_RESULT_LENGTH];
727} DELAYED_IDATA_INSERT;
728
2bac37f9
VK
729/**
730 * Functions
731 */
35f836fe
VK
732BOOL NXCORE_EXPORTABLE ConfigReadStr(const TCHAR *szVar, TCHAR *szBuffer, int iBufSize, const TCHAR *szDefault);
733#ifdef UNICODE
734BOOL NXCORE_EXPORTABLE ConfigReadStrA(const WCHAR *szVar, char *szBuffer, int iBufSize, const char *szDefault);
735#else
736#define ConfigReadStrA ConfigReadStr
737#endif
5039dede 738int NXCORE_EXPORTABLE ConfigReadInt(const TCHAR *szVar, int iDefault);
967893bb 739UINT32 NXCORE_EXPORTABLE ConfigReadULong(const TCHAR *szVar, UINT32 dwDefault);
5039dede
AK
740BOOL NXCORE_EXPORTABLE ConfigReadByteArray(const TCHAR *pszVar, int *pnArray,
741 int nSize, int nDefault);
742BOOL NXCORE_EXPORTABLE ConfigWriteStr(const TCHAR *szVar, const TCHAR *szValue, BOOL bCreate,
743 BOOL isVisible = TRUE, BOOL needRestart = FALSE);
744BOOL NXCORE_EXPORTABLE ConfigWriteInt(const TCHAR *szVar, int iValue, BOOL bCreate,
745 BOOL isVisible = TRUE, BOOL needRestart = FALSE);
967893bb 746BOOL NXCORE_EXPORTABLE ConfigWriteULong(const TCHAR *szVar, UINT32 dwValue, BOOL bCreate,
5039dede
AK
747 BOOL isVisible = TRUE, BOOL needRestart = FALSE);
748BOOL NXCORE_EXPORTABLE ConfigWriteByteArray(const TCHAR *pszVar, int *pnArray,
749 int nSize, BOOL bCreate,
750 BOOL isVisible = TRUE, BOOL needRestart = FALSE);
751TCHAR NXCORE_EXPORTABLE *ConfigReadCLOB(const TCHAR *var, const TCHAR *defValue);
752BOOL NXCORE_EXPORTABLE ConfigWriteCLOB(const TCHAR *var, const TCHAR *value, BOOL bCreate);
753
28f5b9a4
VK
754BOOL NXCORE_EXPORTABLE MetaDataReadStr(const TCHAR *szVar, TCHAR *szBuffer, int iBufSize, const TCHAR *szDefault);
755
35f836fe 756BOOL NXCORE_EXPORTABLE LoadConfig();
5039dede 757
35f836fe
VK
758void NXCORE_EXPORTABLE Shutdown();
759void NXCORE_EXPORTABLE FastShutdown();
760BOOL NXCORE_EXPORTABLE Initialize();
5039dede 761THREAD_RESULT NXCORE_EXPORTABLE THREAD_CALL Main(void *);
35f836fe
VK
762void NXCORE_EXPORTABLE ShutdownDB();
763void InitiateShutdown();
5039dede
AK
764
765BOOL NXCORE_EXPORTABLE SleepAndCheckForShutdown(int iSeconds);
766
35f836fe
VK
767void ConsolePrintf(CONSOLE_CTX pCtx, const TCHAR *pszFormat, ...);
768int ProcessConsoleCommand(const TCHAR *pszCmdLine, CONSOLE_CTX pCtx);
5039dede
AK
769
770void SaveObjects(DB_HANDLE hdb);
ff6d2c5d
VK
771void NXCORE_EXPORTABLE ObjectTransactionStart();
772void NXCORE_EXPORTABLE ObjectTransactionEnd();
5039dede 773
ce7565e7 774void NXCORE_EXPORTABLE QueueSQLRequest(const TCHAR *query);
7dad92fb 775void NXCORE_EXPORTABLE QueueSQLRequest(const TCHAR *query, int bindCount, int *sqlTypes, const TCHAR **values);
967893bb 776void QueueIDataInsert(time_t timestamp, UINT32 nodeId, UINT32 dciId, const TCHAR *value);
ce7565e7
VK
777void StartDBWriter();
778void StopDBWriter();
5039dede 779
967893bb 780bool NXCORE_EXPORTABLE IsDatabaseRecordExist(DB_HANDLE hdb, const TCHAR *table, const TCHAR *idColumn, UINT32 id);
ba89fed2 781
967893bb 782void DecodeSQLStringAndSetVariable(CSCPMessage *pMsg, UINT32 dwVarId, TCHAR *pszStr);
5039dede 783
a26ee2fb 784SNMP_SecurityContext *SnmpCheckCommSettings(SNMP_Transport *pTransport, int *version, SNMP_SecurityContext *originalContext, const TCHAR *customTestOid);
35f836fe 785void StrToMac(const TCHAR *pszStr, BYTE *pBuffer);
5039dede 786
f42b8099 787void InitLocalNetInfo();
5039dede 788
f42b8099 789ARP_CACHE *GetLocalArpCache();
967893bb 790ARP_CACHE *SnmpGetArpCache(UINT32 dwVersion, SNMP_Transport *pTransport);
5039dede 791
98762401 792InterfaceList *GetLocalInterfaceList();
967893bb 793void SnmpGetInterfaceStatus(UINT32 dwVersion, SNMP_Transport *pTransport, UINT32 dwIfIndex, int *adminState, int *operState);
5039dede 794
967893bb 795ROUTING_TABLE *SnmpGetRoutingTable(UINT32 dwVersion, SNMP_Transport *pTransport);
5039dede 796
9796ce45 797void LoadNetworkDeviceDrivers();
21254a93 798NetworkDeviceDriver *FindDriverForNode(Node *node, SNMP_Transport *pTransport);
28e1575f 799NetworkDeviceDriver *FindDriverByName(const TCHAR *name);
9796ce45 800
5ad2167d 801void WatchdogInit();
967893bb
VK
802UINT32 WatchdogAddThread(const TCHAR *szName, time_t tNotifyInterval);
803void WatchdogNotify(UINT32 dwId);
5039dede
AK
804void WatchdogPrintStatus(CONSOLE_CTX pCtx);
805
5ad2167d 806void CheckForMgmtNode();
967893bb
VK
807Node *PollNewNode(UINT32 dwIpAddr, UINT32 dwNetMask, UINT32 dwCreationFlags, WORD agentPort,
808 WORD snmpPort, const TCHAR *pszName, UINT32 dwProxyNode, UINT32 dwSNMPProxy, Cluster *pCluster,
809 UINT32 zoneId, bool doConfPoll, bool discoveredNode);
5039dede 810
b1e9b6b3 811void NXCORE_EXPORTABLE EnumerateClientSessions(void (*pHandler)(ClientSession *, void *), void *pArg);
967893bb 812void NXCORE_EXPORTABLE NotifyClientSessions(UINT32 dwCode, UINT32 dwData);
e1ebbfc2 813int GetSessionCount(bool withRoot = true);
967893bb 814bool IsLoggedIn(UINT32 dwUserId);
5039dede 815
35f836fe 816void GetSysInfoStr(TCHAR *pszBuffer, int nMaxSize);
967893bb 817UINT32 GetLocalIpAddr();
f7694811 818TCHAR *GetLocalHostName(TCHAR *buffer, size_t bufSize);
5039dede 819
35f836fe 820BOOL ExecCommand(TCHAR *pszCommand);
967893bb 821BOOL SendMagicPacket(UINT32 dwIpAddr, BYTE *pbMacAddr, int iNumPackets);
5039dede 822
35f836fe 823BOOL InitIdTable();
967893bb 824UINT32 CreateUniqueId(int iGroup);
35f836fe 825QWORD CreateUniqueEventId();
69bb7f47 826void SaveCurrentFreeId();
5039dede 827
35f836fe
VK
828void InitMailer();
829void ShutdownMailer();
830void NXCORE_EXPORTABLE PostMail(const TCHAR *pszRcpt, const TCHAR *pszSubject, const TCHAR *pszText);
5039dede 831
35f836fe
VK
832void InitSMSSender();
833void ShutdownSMSSender();
834void NXCORE_EXPORTABLE PostSMS(const TCHAR *pszRcpt, const TCHAR *pszText);
5039dede 835
35f836fe 836void InitTraps();
967893bb 837void SendTrapsToClient(ClientSession *pSession, UINT32 dwRqId);
5039dede 838void CreateTrapCfgMessage(CSCPMessage &msg);
967893bb
VK
839UINT32 CreateNewTrap(UINT32 *pdwTrapId);
840UINT32 CreateNewTrap(NXC_TRAP_CFG_ENTRY *pTrap);
841UINT32 UpdateTrapFromMsg(CSCPMessage *pMsg);
842UINT32 DeleteTrap(UINT32 dwId);
843void CreateNXMPTrapRecord(String &str, UINT32 dwId);
844
845BOOL IsTableTool(UINT32 dwToolId);
846BOOL CheckObjectToolAccess(UINT32 dwToolId, UINT32 dwUserId);
847UINT32 ExecuteTableTool(UINT32 dwToolId, Node *pNode, UINT32 dwRqId, ClientSession *pSession);
848UINT32 DeleteObjectToolFromDB(UINT32 dwToolId);
849UINT32 UpdateObjectToolFromMessage(CSCPMessage *pMsg);
850
851UINT32 ModifySummaryTable(CSCPMessage *msg, LONG *newId);
852UINT32 DeleteSummaryTable(LONG tableId);
853Table *QuerySummaryTable(LONG tableId, UINT32 baseObjectId, UINT32 userId, UINT32 *rcc);
b4c2a628 854
e0f99bf0 855void CreateMessageFromSyslogMsg(CSCPMessage *pMsg, NX_SYSLOG_RECORD *pRec);
4262c0dc 856void ReinitializeSyslogParser();
5039dede
AK
857
858void EscapeString(String &str);
859
ce7565e7 860void InitAuditLog();
967893bb
VK
861void NXCORE_EXPORTABLE WriteAuditLog(const TCHAR *subsys, BOOL isSuccess, UINT32 userId,
862 const TCHAR *workstation, UINT32 objectId,
ce7565e7 863 const TCHAR *format, ...);
5039dede 864
967893bb
VK
865bool ValidateConfig(Config *config, UINT32 flags, TCHAR *errorText, int errorTextLen);
866UINT32 ImportConfig(Config *config, UINT32 flags);
5039dede
AK
867
868#ifdef _WITH_ENCRYPTION
869X509 *CertificateFromLoginMessage(CSCPMessage *pMsg);
a50eaebe 870BOOL ValidateUserCertificate(X509 *pCert, const TCHAR *pszLogin, BYTE *pChallenge,
967893bb 871 BYTE *pSignature, UINT32 dwSigLen, int nMappingMethod,
a50eaebe 872 const TCHAR *pszMappingData);
9796ce45 873void ReloadCertificates();
5039dede
AK
874#endif
875
876#ifndef _WIN32
877THREAD_RESULT NXCORE_EXPORTABLE THREAD_CALL SignalHandler(void *);
878#endif /* not _WIN32 */
879
5039dede 880void DbgTestRWLock(RWLOCK hLock, const TCHAR *szName, CONSOLE_CTX pCtx);
534e1b83
VK
881void DumpClientSessions(CONSOLE_CTX pCtx);
882void DumpMobileDeviceSessions(CONSOLE_CTX pCtx);
5039dede 883void ShowPollerState(CONSOLE_CTX pCtx);
35f836fe 884void SetPollerInfo(int nIdx, const TCHAR *pszMsg);
5039dede 885void ShowServerStats(CONSOLE_CTX pCtx);
35f836fe 886void ShowQueueStats(CONSOLE_CTX pCtx, Queue *pQueue, const TCHAR *pszName);
5039dede
AK
887void DumpProcess(CONSOLE_CTX pCtx);
888
534e1b83
VK
889/**
890 * Global variables
891 */
5039dede
AK
892extern TCHAR NXCORE_EXPORTABLE g_szConfigFile[];
893extern TCHAR NXCORE_EXPORTABLE g_szLogFile[];
967893bb
VK
894extern UINT32 g_dwLogRotationMode;
895extern UINT32 g_dwMaxLogSize;
896extern UINT32 g_dwLogHistorySize;
4f8998ca 897extern TCHAR g_szDailyLogFileSuffix[64];
5039dede
AK
898extern TCHAR NXCORE_EXPORTABLE g_szDumpDir[];
899extern TCHAR NXCORE_EXPORTABLE g_szListenAddress[];
900#ifndef _WIN32
901extern TCHAR NXCORE_EXPORTABLE g_szPIDFile[];
902#endif
903extern TCHAR g_szDataDir[];
9796ce45 904extern TCHAR g_szLibDir[];
712dd47d 905extern TCHAR g_szJavaLibDir[];
967893bb 906extern UINT32 NXCORE_EXPORTABLE g_processAffinityMask;
5039dede
AK
907extern QWORD g_qwServerId;
908extern RSA *g_pServerKey;
c59466d2
VK
909extern UINT32 g_icmpPingSize;
910extern UINT32 g_icmpPingTimeout;
911extern UINT32 g_auditFlags;
912extern time_t g_serverStartTime;
913extern UINT32 g_lockTimeout;
914extern UINT32 g_agentCommandTimeout;
915extern UINT32 g_thresholdRepeatInterval;
916extern int g_requiredPolls;
917extern UINT32 g_slmPollingInterval;
5039dede 918
b8c1ec69
VK
919extern TCHAR g_szDbDriver[];
920extern TCHAR g_szDbDrvParams[];
921extern TCHAR g_szDbServer[];
922extern TCHAR g_szDbLogin[];
923extern TCHAR g_szDbPassword[];
924extern TCHAR g_szDbName[];
f3c30cf5 925extern TCHAR g_szDbSchema[];
712dd47d 926extern TCHAR NXCORE_EXPORTABLE g_szJavaPath[];
b8c1ec69 927extern DB_DRIVER g_dbDriver;
5039dede
AK
928extern DB_HANDLE NXCORE_EXPORTABLE g_hCoreDB;
929extern Queue *g_pLazyRequestQueue;
c9a9601c 930extern Queue *g_pIDataInsertQueue;
5039dede 931
28f5b9a4 932extern int NXCORE_EXPORTABLE g_nDBSyntax;
5039dede
AK
933
934#endif /* _nms_core_h_ */