raw_dci_values UPDATE optimization; next build number; minor fixes in Windows build
[public/netxms.git] / src / server / include / nms_core.h
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2003-2014 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 ** 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
51 #define WSAGetLastError() (errno)
52
53 #endif /* _WIN32 */
54
55 #include <time.h>
56 #include <stdio.h>
57 #include <string.h>
58 #include <stdarg.h>
59
60 #ifdef _WITH_ENCRYPTION
61 #include <openssl/ssl.h>
62 #endif
63
64 #define SHOW_FLAG_VALUE(x) _T(" %-32s = %d\n"), _T(#x), (g_flags & x) ? 1 : 0
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>
75 #include <nxqueue.h>
76 #include <nxsnmp.h>
77 #include <nxmodule.h>
78 #include <nxsl.h>
79 #include <nxdbapi.h>
80 #include <nddrv.h>
81 #include <nxcore_smclp.h>
82
83 /**
84 * Console context
85 */
86 struct __console_ctx
87 {
88 SOCKET hSocket;
89 MUTEX socketMutex;
90 CSCPMessage *pMsg;
91 ClientSession *session;
92 String *output;
93 };
94
95 typedef __console_ctx * CONSOLE_CTX;
96
97 /**
98 * Server includes
99 */
100 #include "server_timers.h"
101 #include "nms_dcoll.h"
102 #include "nms_users.h"
103 #include "nxcore_winperf.h"
104 #include "nms_objects.h"
105 #include "nms_locks.h"
106 #include "nms_pkg.h"
107 #include "nms_topo.h"
108 #include "nms_script.h"
109 #include "nxcore_situations.h"
110 #include "nxcore_jobs.h"
111 #include "nxcore_logs.h"
112
113 /**
114 * Common constants and macros
115 */
116 #define MAX_LINE_SIZE 4096
117 #define GROUP_FLAG_BIT ((UINT32)0x80000000)
118 #define CHECKPOINT_SNMP_PORT 260
119 #define DEFAULT_AFFINITY_MASK 0xFFFFFFFF
120
121 #define MAX_CLIENT_SESSIONS 128
122 #define MAX_DEVICE_SESSIONS 256
123
124 typedef void * HSNMPSESSION;
125
126 /**
127 * Prefixes for poller messages
128 */
129 #define POLLER_ERROR _T("\x7F") _T("e")
130 #define POLLER_WARNING _T("\x7Fw")
131 #define POLLER_INFO _T("\x7Fi")
132
133 /**
134 * Unique identifier group codes
135 */
136 #define IDG_NETWORK_OBJECT 0
137 #define IDG_CONTAINER_CAT 1
138 #define IDG_EVENT 2
139 #define IDG_ITEM 3
140 #define IDG_SNMP_TRAP 4
141 #define IDG_JOB 5
142 #define IDG_ACTION 6
143 #define IDG_EVENT_GROUP 7
144 #define IDG_THRESHOLD 8
145 #define IDG_USER 9
146 #define IDG_USER_GROUP 10
147 #define IDG_ALARM 11
148 #define IDG_ALARM_NOTE 12
149 #define IDG_PACKAGE 13
150 #define IDG_SLM_TICKET 14
151 #define IDG_OBJECT_TOOL 15
152 #define IDG_SCRIPT 16
153 #define IDG_AGENT_CONFIG 17
154 #define IDG_GRAPH 18
155 #define IDG_CERTIFICATE 19
156 #define IDG_SITUATION 20
157 #define IDG_DCT_COLUMN 21
158 #define IDG_MAPPING_TABLE 22
159 #define IDG_DCI_SUMMARY_TABLE 23
160
161 /**
162 * Exit codes for console commands
163 */
164 #define CMD_EXIT_CONTINUE 0
165 #define CMD_EXIT_CLOSE_SESSION 1
166 #define CMD_EXIT_SHUTDOWN 2
167
168 /**
169 * Network discovery mode
170 */
171 #define DISCOVERY_DISABLED 0
172 #define DISCOVERY_PASSIVE_ONLY 1
173 #define DISCOVERY_ACTIVE 2
174
175 /**
176 * Client session flags
177 */
178 #define CSF_EPP_LOCKED ((UINT32)0x00000002)
179 #define CSF_PACKAGE_DB_LOCKED ((UINT32)0x00000004)
180 #define CSF_USER_DB_LOCKED ((UINT32)0x00000008)
181 #define CSF_EPP_UPLOAD ((UINT32)0x00000010)
182 #define CSF_CONSOLE_OPEN ((UINT32)0x00000020)
183 #define CSF_AUTHENTICATED ((UINT32)0x00000080)
184 #define CSF_RECEIVING_MAP_DATA ((UINT32)0x00000200)
185 #define CSF_SYNC_OBJECT_COMMENTS ((UINT32)0x00000400)
186 #define CSF_CUSTOM_LOCK_1 ((UINT32)0x01000000)
187 #define CSF_CUSTOM_LOCK_2 ((UINT32)0x02000000)
188 #define CSF_CUSTOM_LOCK_3 ((UINT32)0x04000000)
189 #define CSF_CUSTOM_LOCK_4 ((UINT32)0x08000000)
190 #define CSF_CUSTOM_LOCK_5 ((UINT32)0x10000000)
191 #define CSF_CUSTOM_LOCK_6 ((UINT32)0x20000000)
192 #define CSF_CUSTOM_LOCK_7 ((UINT32)0x40000000)
193 #define CSF_CUSTOM_LOCK_8 ((UINT32)0x80000000)
194
195 /**
196 * Client session states
197 */
198 #define SESSION_STATE_INIT 0
199 #define SESSION_STATE_IDLE 1
200 #define SESSION_STATE_PROCESSING 2
201
202 /**
203 * Information categories for UPDATE_INFO structure
204 */
205 #define INFO_CAT_EVENT 1
206 #define INFO_CAT_OBJECT_CHANGE 2
207 #define INFO_CAT_ALARM 3
208 #define INFO_CAT_ACTION 4
209 #define INFO_CAT_SYSLOG_MSG 5
210 #define INFO_CAT_SNMP_TRAP 6
211 #define INFO_CAT_AUDIT_RECORD 7
212 #define INFO_CAT_SITUATION 8
213 #define INFO_CAT_LIBRARY_IMAGE 9
214
215 /**
216 * Certificate types
217 */
218 #define CERT_TYPE_TRUSTED_CA 0
219 #define CERT_TYPE_USER 1
220
221 /**
222 * Audit subsystems
223 */
224 #define AUDIT_SECURITY _T("SECURITY")
225 #define AUDIT_OBJECTS _T("OBJECTS")
226 #define AUDIT_SYSCFG _T("SYSCFG")
227 #define AUDIT_CONSOLE _T("CONSOLE")
228
229 #define AUDIT_SYSTEM_SID (-1)
230
231 /**
232 * Event handling subsystem definitions
233 */
234 #include "nms_events.h"
235 #include "nms_actions.h"
236 #include "nms_alarm.h"
237
238 /**
239 * New node information
240 */
241 typedef struct
242 {
243 UINT32 dwIpAddr;
244 UINT32 dwNetMask;
245 UINT32 zoneId;
246 BOOL ignoreFilter;
247 BYTE bMacAddr[MAC_ADDR_LENGTH];
248 } NEW_NODE;
249
250 /**
251 * New node flags
252 */
253 #define NNF_IS_SNMP 0x0001
254 #define NNF_IS_AGENT 0x0002
255 #define NNF_IS_ROUTER 0x0004
256 #define NNF_IS_BRIDGE 0x0008
257 #define NNF_IS_PRINTER 0x0010
258 #define NNF_IS_CDP 0x0020
259 #define NNF_IS_SONMP 0x0040
260 #define NNF_IS_LLDP 0x0080
261
262 /**
263 * Node information for autodiscovery filter
264 */
265 typedef struct
266 {
267 UINT32 dwIpAddr;
268 UINT32 dwNetMask;
269 UINT32 dwSubnetAddr;
270 UINT32 dwFlags;
271 int nSNMPVersion;
272 TCHAR szObjectId[MAX_OID_LEN * 4]; // SNMP OID
273 TCHAR szAgentVersion[MAX_AGENT_VERSION_LEN];
274 TCHAR szPlatform[MAX_PLATFORM_NAME_LEN];
275 } DISCOVERY_FILTER_DATA;
276
277 /**
278 * Data update structure for client sessions
279 */
280 typedef struct
281 {
282 UINT32 dwCategory; // Data category - event, network object, etc.
283 UINT32 dwCode; // Data-specific update code
284 void *pData; // Pointer to data block
285 } UPDATE_INFO;
286
287 /**
288 * Extended agent connection
289 */
290 class AgentConnectionEx : public AgentConnection
291 {
292 protected:
293 UINT32 m_nodeId;
294
295 virtual void printMsg(const TCHAR *format, ...);
296 virtual void onTrap(CSCPMessage *msg);
297 virtual void onDataPush(CSCPMessage *msg);
298 virtual void onFileMonitoringData(CSCPMessage *msg);
299
300 public:
301 AgentConnectionEx(UINT32 nodeId, UINT32 ipAddr, WORD port = AGENT_LISTEN_PORT, int authMethod = AUTH_NONE, const TCHAR *secret = NULL) :
302 AgentConnection(ipAddr, port, authMethod, secret) { m_nodeId = nodeId; }
303 virtual ~AgentConnectionEx();
304
305 UINT32 deployPolicy(AgentPolicy *policy);
306 UINT32 uninstallPolicy(AgentPolicy *policy);
307 };
308
309 /**
310 * Mobile device session
311 */
312 class NXCORE_EXPORTABLE MobileDeviceSession
313 {
314 private:
315 SOCKET m_hSocket;
316 Queue *m_pSendQueue;
317 Queue *m_pMessageQueue;
318 int m_id;
319 int m_state;
320 WORD m_wCurrentCmd;
321 UINT32 m_dwUserId;
322 UINT32 m_deviceObjectId;
323 CSCP_BUFFER *m_pMsgBuffer;
324 NXCPEncryptionContext *m_pCtx;
325 BYTE m_challenge[CLIENT_CHALLENGE_SIZE];
326 THREAD m_hWriteThread;
327 THREAD m_hProcessingThread;
328 MUTEX m_mutexSocketWrite;
329 struct sockaddr *m_clientAddr;
330 TCHAR m_szHostName[256]; // IP address of name of conneced host in textual form
331 TCHAR m_szUserName[MAX_SESSION_NAME]; // String in form login_name@host
332 TCHAR m_szClientInfo[96]; // Client app info string
333 UINT32 m_dwEncryptionRqId;
334 UINT32 m_dwEncryptionResult;
335 CONDITION m_condEncryptionSetup;
336 UINT32 m_dwRefCount;
337 bool m_isAuthenticated;
338
339 static THREAD_RESULT THREAD_CALL readThreadStarter(void *);
340 static THREAD_RESULT THREAD_CALL writeThreadStarter(void *);
341 static THREAD_RESULT THREAD_CALL processingThreadStarter(void *);
342
343 void readThread();
344 void writeThread();
345 void processingThread();
346
347 void setupEncryption(CSCPMessage *request);
348 void respondToKeepalive(UINT32 dwRqId);
349 void debugPrintf(int level, const TCHAR *format, ...);
350 void sendServerInfo(UINT32 dwRqId);
351 void login(CSCPMessage *pRequest);
352 void updateDeviceInfo(CSCPMessage *pRequest);
353 void updateDeviceStatus(CSCPMessage *pRequest);
354 void pushData(CSCPMessage *request);
355
356 public:
357 MobileDeviceSession(SOCKET hSocket, struct sockaddr *addr);
358 ~MobileDeviceSession();
359
360 void incRefCount() { m_dwRefCount++; }
361 void decRefCount() { if (m_dwRefCount > 0) m_dwRefCount--; }
362
363 void run();
364
365 void postMessage(CSCPMessage *pMsg) { m_pSendQueue->Put(pMsg->createMessage()); }
366 void sendMessage(CSCPMessage *pMsg);
367
368 int getId() { return m_id; }
369 void setId(int id) { if (m_id == -1) m_id = id; }
370 int getState() { return m_state; }
371 const TCHAR *getUserName() { return m_szUserName; }
372 const TCHAR *getClientInfo() { return m_szClientInfo; }
373 const TCHAR *getHostName() { return m_szHostName; }
374 UINT32 getUserId() { return m_dwUserId; }
375 bool isAuthenticated() { return m_isAuthenticated; }
376 WORD getCurrentCmd() { return m_wCurrentCmd; }
377 int getCipher() { return (m_pCtx == NULL) ? -1 : m_pCtx->getCipher(); }
378 };
379
380 /**
381 * Client (user) session
382 */
383 #define DECLARE_THREAD_STARTER(func) static THREAD_RESULT THREAD_CALL ThreadStarter_##func(void *);
384
385 class NXCORE_EXPORTABLE ClientSession
386 {
387 private:
388 SOCKET m_hSocket;
389 Queue *m_pSendQueue;
390 Queue *m_pMessageQueue;
391 Queue *m_pUpdateQueue;
392 int m_id;
393 int m_state;
394 WORD m_wCurrentCmd;
395 UINT32 m_dwUserId;
396 UINT64 m_dwSystemAccess; // User's system access rights
397 UINT32 m_dwFlags; // Session flags
398 int m_clientType; // Client system type - desktop, web, mobile, etc.
399 CSCP_BUFFER *m_pMsgBuffer;
400 NXCPEncryptionContext *m_pCtx;
401 BYTE m_challenge[CLIENT_CHALLENGE_SIZE];
402 THREAD m_hWriteThread;
403 THREAD m_hProcessingThread;
404 THREAD m_hUpdateThread;
405 MUTEX m_mutexSocketWrite;
406 MUTEX m_mutexSendEvents;
407 MUTEX m_mutexSendSyslog;
408 MUTEX m_mutexSendTrapLog;
409 MUTEX m_mutexSendObjects;
410 MUTEX m_mutexSendAlarms;
411 MUTEX m_mutexSendActions;
412 MUTEX m_mutexSendAuditLog;
413 MUTEX m_mutexSendSituations;
414 MUTEX m_mutexPollerInit;
415 struct sockaddr *m_clientAddr;
416 TCHAR m_workstation[256]; // IP address or name of connected host in textual form
417 TCHAR m_webServerAddress[256]; // IP address or name of web server for web sessions
418 TCHAR m_szUserName[MAX_SESSION_NAME]; // String in form login_name@host
419 TCHAR m_szClientInfo[96]; // Client app info string
420 TCHAR m_language[8]; // Client's desired language
421 time_t m_loginTime;
422 UINT32 m_dwOpenDCIListSize; // Number of open DCI lists
423 UINT32 *m_pOpenDCIList; // List of nodes with DCI lists open
424 UINT32 m_dwNumRecordsToUpload; // Number of records to be uploaded
425 UINT32 m_dwRecordsUploaded;
426 EPRule **m_ppEPPRuleList; // List of loaded EPP rules
427 int m_hCurrFile;
428 UINT32 m_dwFileRqId;
429 UINT32 m_dwUploadCommand;
430 UINT32 m_dwUploadData;
431 uuid_t m_uploadImageGuid;
432 TCHAR m_szCurrFileName[MAX_PATH];
433 UINT32 m_dwRefCount;
434 UINT32 m_dwEncryptionRqId;
435 UINT32 m_dwEncryptionResult;
436 CONDITION m_condEncryptionSetup;
437 UINT32 m_dwActiveChannels; // Active data channels
438 CONSOLE_CTX m_console; // Server console context
439 StringList m_musicTypeList;
440 ObjectIndex m_agentConn;
441
442 static THREAD_RESULT THREAD_CALL readThreadStarter(void *);
443 static THREAD_RESULT THREAD_CALL writeThreadStarter(void *);
444 static THREAD_RESULT THREAD_CALL processingThreadStarter(void *);
445 static THREAD_RESULT THREAD_CALL updateThreadStarter(void *);
446 static THREAD_RESULT THREAD_CALL pollerThreadStarter(void *);
447
448 DECLARE_THREAD_STARTER(getCollectedData)
449 DECLARE_THREAD_STARTER(getTableCollectedData)
450 DECLARE_THREAD_STARTER(clearDCIData)
451 DECLARE_THREAD_STARTER(queryParameter)
452 DECLARE_THREAD_STARTER(queryAgentTable)
453 DECLARE_THREAD_STARTER(queryL2Topology)
454 DECLARE_THREAD_STARTER(sendEventLog)
455 DECLARE_THREAD_STARTER(sendSyslog)
456 DECLARE_THREAD_STARTER(createObject)
457 DECLARE_THREAD_STARTER(getServerFile)
458 DECLARE_THREAD_STARTER(getAgentFile)
459 DECLARE_THREAD_STARTER(cancelFileMonitoring)
460 DECLARE_THREAD_STARTER(queryServerLog)
461 DECLARE_THREAD_STARTER(getServerLogQueryData)
462 DECLARE_THREAD_STARTER(executeAction)
463 DECLARE_THREAD_STARTER(findNodeConnection)
464 DECLARE_THREAD_STARTER(findMacAddress)
465 DECLARE_THREAD_STARTER(findIpAddress)
466 DECLARE_THREAD_STARTER(processConsoleCommand)
467 DECLARE_THREAD_STARTER(sendMib)
468 DECLARE_THREAD_STARTER(getNetworkPath)
469 DECLARE_THREAD_STARTER(getAlarmEvents)
470 DECLARE_THREAD_STARTER(openHelpdeskIssue)
471 DECLARE_THREAD_STARTER(forwardToReportingServer)
472 DECLARE_THREAD_STARTER(fileManagerControl)
473 DECLARE_THREAD_STARTER(uploadUserFileToAgent)
474 DECLARE_THREAD_STARTER(getSwitchForwardingDatabase)
475 DECLARE_THREAD_STARTER(getRoutingTable)
476 DECLARE_THREAD_STARTER(getLocationHistory)
477
478 void readThread();
479 void writeThread();
480 void processingThread();
481 void updateThread();
482 void pollerThread(Node *pNode, int iPollType, UINT32 dwRqId);
483
484 void setupEncryption(CSCPMessage *request);
485 void respondToKeepalive(UINT32 dwRqId);
486 void onFileUpload(BOOL bSuccess);
487 void debugPrintf(int level, const TCHAR *format, ...);
488 void sendServerInfo(UINT32 dwRqId);
489 void login(CSCPMessage *pRequest);
490 void sendAllObjects(CSCPMessage *pRequest);
491 void sendSelectedObjects(CSCPMessage *pRequest);
492 void sendEventLog(CSCPMessage *pRequest);
493 void sendAllConfigVars(UINT32 dwRqId);
494 void setConfigVariable(CSCPMessage *pRequest);
495 void deleteConfigVariable(CSCPMessage *pRequest);
496 void sendUserDB(UINT32 dwRqId);
497 void sendAllAlarms(UINT32 dwRqId);
498 void createUser(CSCPMessage *pRequest);
499 void updateUser(CSCPMessage *pRequest);
500 void deleteUser(CSCPMessage *pRequest);
501 void setPassword(CSCPMessage *pRequest);
502 void lockUserDB(UINT32 dwRqId, BOOL bLock);
503 void sendEventDB(UINT32 dwRqId);
504 void modifyEventTemplate(CSCPMessage *pRequest);
505 void deleteEventTemplate(CSCPMessage *pRequest);
506 void generateEventCode(UINT32 dwRqId);
507 void modifyObject(CSCPMessage *pRequest);
508 void changeObjectMgmtStatus(CSCPMessage *pRequest);
509 void openNodeDCIList(CSCPMessage *pRequest);
510 void closeNodeDCIList(CSCPMessage *pRequest);
511 void modifyNodeDCI(CSCPMessage *pRequest);
512 void copyDCI(CSCPMessage *pRequest);
513 void applyTemplate(CSCPMessage *pRequest);
514 void getCollectedData(CSCPMessage *pRequest);
515 void getTableCollectedData(CSCPMessage *pRequest);
516 bool getCollectedDataFromDB(CSCPMessage *request, CSCPMessage *response, DataCollectionTarget *object, int dciType);
517 void clearDCIData(CSCPMessage *pRequest);
518 void changeDCIStatus(CSCPMessage *pRequest);
519 void getLastValues(CSCPMessage *pRequest);
520 void getLastValuesByDciId(CSCPMessage *pRequest);
521 void getTableLastValues(CSCPMessage *pRequest);
522 void getThresholdSummary(CSCPMessage *request);
523 void openEPP(CSCPMessage *request);
524 void closeEPP(UINT32 dwRqId);
525 void saveEPP(CSCPMessage *pRequest);
526 void processEPPRecord(CSCPMessage *pRequest);
527 void sendMIBTimestamp(UINT32 dwRqId);
528 void sendMib(CSCPMessage *request);
529 void createObject(CSCPMessage *request);
530 void changeObjectBinding(CSCPMessage *request, BOOL bBind);
531 void deleteObject(CSCPMessage *request);
532 void getAlarm(CSCPMessage *request);
533 void getAlarmEvents(CSCPMessage *request);
534 void acknowledgeAlarm(CSCPMessage *request);
535 void resolveAlarm(CSCPMessage *request, bool terminate);
536 void deleteAlarm(CSCPMessage *request);
537 void openHelpdeskIssue(CSCPMessage *request);
538 void getHelpdeskUrl(CSCPMessage *request);
539 void unlinkHelpdeskIssue(CSCPMessage *request);
540 void getAlarmComments(CSCPMessage *pRequest);
541 void updateAlarmComment(CSCPMessage *pRequest);
542 void deleteAlarmComment(CSCPMessage *request);
543 void updateAlarmStatusFlow(CSCPMessage *request);
544 void createAction(CSCPMessage *pRequest);
545 void updateAction(CSCPMessage *pRequest);
546 void deleteAction(CSCPMessage *pRequest);
547 void sendAllActions(UINT32 dwRqId);
548 void SendContainerCategories(UINT32 dwRqId);
549 void forcedNodePoll(CSCPMessage *pRequest);
550 void onTrap(CSCPMessage *pRequest);
551 void onWakeUpNode(CSCPMessage *pRequest);
552 void queryParameter(CSCPMessage *pRequest);
553 void queryAgentTable(CSCPMessage *pRequest);
554 void editTrap(int iOperation, CSCPMessage *pRequest);
555 void LockTrapCfg(UINT32 dwRqId, BOOL bLock);
556 void sendAllTraps(UINT32 dwRqId);
557 void sendAllTraps2(UINT32 dwRqId);
558 void LockPackageDB(UINT32 dwRqId, BOOL bLock);
559 void SendAllPackages(UINT32 dwRqId);
560 void InstallPackage(CSCPMessage *pRequest);
561 void RemovePackage(CSCPMessage *pRequest);
562 void DeployPackage(CSCPMessage *pRequest);
563 void getParametersList(CSCPMessage *pRequest);
564 void getUserVariable(CSCPMessage *pRequest);
565 void setUserVariable(CSCPMessage *pRequest);
566 void copyUserVariable(CSCPMessage *pRequest);
567 void enumUserVariables(CSCPMessage *pRequest);
568 void deleteUserVariable(CSCPMessage *pRequest);
569 void changeObjectZone(CSCPMessage *pRequest);
570 void getAgentConfig(CSCPMessage *pRequest);
571 void updateAgentConfig(CSCPMessage *pRequest);
572 void executeAction(CSCPMessage *pRequest);
573 void sendObjectTools(UINT32 dwRqId);
574 void sendObjectToolDetails(CSCPMessage *pRequest);
575 void updateObjectTool(CSCPMessage *pRequest);
576 void deleteObjectTool(CSCPMessage *pRequest);
577 void changeObjectToolStatus(CSCPMessage *pRequest);
578 void generateObjectToolId(UINT32 dwRqId);
579 void execTableTool(CSCPMessage *pRequest);
580 void changeSubscription(CSCPMessage *pRequest);
581 void sendSyslog(CSCPMessage *pRequest);
582 void sendServerStats(UINT32 dwRqId);
583 void sendScriptList(UINT32 dwRqId);
584 void sendScript(CSCPMessage *pRequest);
585 void updateScript(CSCPMessage *pRequest);
586 void renameScript(CSCPMessage *pRequest);
587 void deleteScript(CSCPMessage *pRequest);
588 void SendSessionList(UINT32 dwRqId);
589 void KillSession(CSCPMessage *pRequest);
590 void SendTrapLog(CSCPMessage *pRequest);
591 void StartSnmpWalk(CSCPMessage *pRequest);
592 void resolveDCINames(CSCPMessage *pRequest);
593 UINT32 resolveDCIName(UINT32 dwNode, UINT32 dwItem, TCHAR **ppszName);
594 void sendConfigForAgent(CSCPMessage *pRequest);
595 void sendAgentCfgList(UINT32 dwRqId);
596 void OpenAgentConfig(CSCPMessage *pRequest);
597 void SaveAgentConfig(CSCPMessage *pRequest);
598 void DeleteAgentConfig(CSCPMessage *pRequest);
599 void SwapAgentConfigs(CSCPMessage *pRequest);
600 void SendObjectComments(CSCPMessage *pRequest);
601 void updateObjectComments(CSCPMessage *pRequest);
602 void pushDCIData(CSCPMessage *pRequest);
603 void getAddrList(CSCPMessage *pRequest);
604 void setAddrList(CSCPMessage *pRequest);
605 void resetComponent(CSCPMessage *pRequest);
606 void sendDCIEventList(CSCPMessage *request);
607 void SendDCIInfo(CSCPMessage *pRequest);
608 void sendPerfTabDCIList(CSCPMessage *pRequest);
609 void exportConfiguration(CSCPMessage *pRequest);
610 void importConfiguration(CSCPMessage *pRequest);
611 void sendGraphList(UINT32 dwRqId);
612 void saveGraph(CSCPMessage *pRequest);
613 void deleteGraph(CSCPMessage *pRequest);
614 void AddCACertificate(CSCPMessage *pRequest);
615 void DeleteCertificate(CSCPMessage *pRequest);
616 void UpdateCertificateComments(CSCPMessage *pRequest);
617 void getCertificateList(UINT32 dwRqId);
618 void queryL2Topology(CSCPMessage *pRequest);
619 void sendSMS(CSCPMessage *pRequest);
620 void SendCommunityList(UINT32 dwRqId);
621 void UpdateCommunityList(CSCPMessage *pRequest);
622 void getSituationList(UINT32 dwRqId);
623 void createSituation(CSCPMessage *pRequest);
624 void updateSituation(CSCPMessage *pRequest);
625 void deleteSituation(CSCPMessage *pRequest);
626 void deleteSituationInstance(CSCPMessage *pRequest);
627 void setConfigCLOB(CSCPMessage *pRequest);
628 void getConfigCLOB(CSCPMessage *pRequest);
629 void registerAgent(CSCPMessage *pRequest);
630 void getServerFile(CSCPMessage *pRequest);
631 void cancelFileMonitoring(CSCPMessage *request);
632 void getAgentFile(CSCPMessage *pRequest);
633 void testDCITransformation(CSCPMessage *pRequest);
634 void sendJobList(UINT32 dwRqId);
635 void cancelJob(CSCPMessage *pRequest);
636 void holdJob(CSCPMessage *pRequest);
637 void unholdJob(CSCPMessage *pRequest);
638 void deployAgentPolicy(CSCPMessage *pRequest, bool uninstallFlag);
639 void getUserCustomAttribute(CSCPMessage *request);
640 void setUserCustomAttribute(CSCPMessage *request);
641 void openServerLog(CSCPMessage *request);
642 void closeServerLog(CSCPMessage *request);
643 void queryServerLog(CSCPMessage *request);
644 void getServerLogQueryData(CSCPMessage *request);
645 void sendUsmCredentials(UINT32 dwRqId);
646 void updateUsmCredentials(CSCPMessage *pRequest);
647 void sendDCIThresholds(CSCPMessage *request);
648 void addClusterNode(CSCPMessage *request);
649 void findNodeConnection(CSCPMessage *request);
650 void findMacAddress(CSCPMessage *request);
651 void findIpAddress(CSCPMessage *request);
652 void sendLibraryImage(CSCPMessage *request);
653 void updateLibraryImage(CSCPMessage *request);
654 void listLibraryImages(CSCPMessage *request);
655 void deleteLibraryImage(CSCPMessage *request);
656 void executeServerCommand(CSCPMessage *request);
657 void uploadFileToAgent(CSCPMessage *request);
658 void listServerFileStore(CSCPMessage *request);
659 void processConsoleCommand(CSCPMessage *msg);
660 void openConsole(UINT32 rqId);
661 void closeConsole(UINT32 rqId);
662 void getVlans(CSCPMessage *msg);
663 void receiveFile(CSCPMessage *request);
664 void deleteFile(CSCPMessage *request);
665 void getNetworkPath(CSCPMessage *request);
666 void getNodeComponents(CSCPMessage *request);
667 void getNodeSoftware(CSCPMessage *request);
668 void getWinPerfObjects(CSCPMessage *request);
669 void listMappingTables(CSCPMessage *request);
670 void getMappingTable(CSCPMessage *request);
671 void updateMappingTable(CSCPMessage *request);
672 void deleteMappingTable(CSCPMessage *request);
673 void getWirelessStations(CSCPMessage *request);
674 void getSummaryTables(UINT32 rqId);
675 void getSummaryTableDetails(CSCPMessage *request);
676 void modifySummaryTable(CSCPMessage *request);
677 void deleteSummaryTable(CSCPMessage *request);
678 void querySummaryTable(CSCPMessage *request);
679 void forwardToReportingServer(CSCPMessage *request);
680 void getSubnetAddressMap(CSCPMessage *request);
681 void getEffectiveRights(CSCPMessage *request);
682 void fileManagerControl(CSCPMessage *request);
683 void uploadUserFileToAgent(CSCPMessage *request);
684 void getSwitchForwardingDatabase(CSCPMessage *request);
685 void getRoutingTable(CSCPMessage *request);
686 void getLocationHistory(CSCPMessage *request);
687
688 public:
689 ClientSession(SOCKET hSocket, struct sockaddr *addr);
690 ~ClientSession();
691
692 void incRefCount() { m_dwRefCount++; }
693 void decRefCount() { if (m_dwRefCount > 0) m_dwRefCount--; }
694
695 void run();
696
697 void postMessage(CSCPMessage *pMsg) { m_pSendQueue->Put(pMsg->createMessage()); }
698 void sendMessage(CSCPMessage *pMsg);
699 void sendRawMessage(CSCP_MESSAGE *pMsg);
700 void sendPollerMsg(UINT32 dwRqId, const TCHAR *pszMsg);
701 BOOL sendFile(const TCHAR *file, UINT32 dwRqId, long offset);
702
703 int getId() { return m_id; }
704 void setId(int id) { if (m_id == -1) m_id = id; }
705 int getState() { return m_state; }
706 const TCHAR *getUserName() { return m_szUserName; }
707 const TCHAR *getClientInfo() { return m_szClientInfo; }
708 const TCHAR *getWorkstation() { return m_workstation; }
709 const TCHAR *getWebServerAddress() { return m_webServerAddress; }
710 UINT32 getUserId() { return m_dwUserId; }
711 UINT64 getSystemRights() { return m_dwSystemAccess; }
712 UINT32 getFlags() { return m_dwFlags; }
713 bool isAuthenticated() { return (m_dwFlags & CSF_AUTHENTICATED) ? true : false; }
714 bool isConsoleOpen() { return (m_dwFlags & CSF_CONSOLE_OPEN) ? true : false; }
715 bool isSubscribed(UINT32 dwChannel) { return (m_dwActiveChannels & dwChannel) ? true : false; }
716 WORD getCurrentCmd() { return m_wCurrentCmd; }
717 int getCipher() { return (m_pCtx == NULL) ? -1 : m_pCtx->getCipher(); }
718 int getClientType() { return m_clientType; }
719 time_t getLoginTime() { return m_loginTime; }
720
721 bool checkSysAccessRights(UINT64 requiredAccess)
722 {
723 return (m_dwUserId == 0) ? true :
724 ((requiredAccess & m_dwSystemAccess) == requiredAccess);
725 }
726
727 void setCustomLock(UINT32 bit, bool value)
728 {
729 if (value)
730 m_dwFlags |= (bit & 0xFF000000);
731 else
732 m_dwFlags &= ~(bit & 0xFF000000);
733 }
734
735 void kill();
736 void notify(UINT32 dwCode, UINT32 dwData = 0);
737
738 void queueUpdate(UPDATE_INFO *pUpdate) { m_pUpdateQueue->Put(pUpdate); }
739 void onNewEvent(Event *pEvent);
740 void onSyslogMessage(NX_SYSLOG_RECORD *pRec);
741 void onNewSNMPTrap(CSCPMessage *pMsg);
742 void onObjectChange(NetObj *pObject);
743 void onUserDBUpdate(int code, UINT32 id, UserDatabaseObject *user);
744 void onAlarmUpdate(UINT32 dwCode, NXC_ALARM *pAlarm);
745 void onActionDBUpdate(UINT32 dwCode, NXC_ACTION *pAction);
746 void onSituationChange(CSCPMessage *msg);
747 void onLibraryImageChange(uuid_t *guid, bool removed = false);
748 };
749
750 /**
751 * Delayed SQL request
752 */
753 typedef struct
754 {
755 TCHAR *query;
756 int bindCount;
757 BYTE *sqlTypes;
758 TCHAR *bindings[1]; /* actual size determined by bindCount field */
759 } DELAYED_SQL_REQUEST;
760
761 /**
762 * Delayed request for idata_ INSERT
763 */
764 typedef struct
765 {
766 time_t timestamp;
767 UINT32 nodeId;
768 UINT32 dciId;
769 TCHAR value[MAX_RESULT_LENGTH];
770 } DELAYED_IDATA_INSERT;
771
772 /**
773 * Delayed request for raw_dci_values UPDATE
774 */
775 typedef struct
776 {
777 time_t timestamp;
778 UINT32 dciId;
779 TCHAR rawValue[MAX_RESULT_LENGTH];
780 TCHAR transformedValue[MAX_RESULT_LENGTH];
781 } DELAYED_RAW_DATA_UPDATE;
782
783 /**
784 * Graph ACL entry
785 */
786 struct GRAPH_ACL_ENTRY
787 {
788 UINT32 dwGraphId;
789 UINT32 dwUserId;
790 UINT32 dwAccess;
791 };
792
793 /**
794 * Information about graph with name existence and it's ID.
795 */
796 struct GRAPH_ACL_AND_ID
797 {
798 UINT32 graphId;
799 UINT32 status;
800 };
801
802 /**
803 * Functions
804 */
805 bool NXCORE_EXPORTABLE ConfigReadStr(const TCHAR *szVar, TCHAR *szBuffer, int iBufSize, const TCHAR *szDefault);
806 #ifdef UNICODE
807 bool NXCORE_EXPORTABLE ConfigReadStrA(const WCHAR *szVar, char *szBuffer, int iBufSize, const char *szDefault);
808 #else
809 #define ConfigReadStrA ConfigReadStr
810 #endif
811 bool NXCORE_EXPORTABLE ConfigReadStrUTF8(const TCHAR *szVar, char *szBuffer, int iBufSize, const char *szDefault);
812 int NXCORE_EXPORTABLE ConfigReadInt(const TCHAR *szVar, int iDefault);
813 UINT32 NXCORE_EXPORTABLE ConfigReadULong(const TCHAR *szVar, UINT32 dwDefault);
814 bool NXCORE_EXPORTABLE ConfigReadByteArray(const TCHAR *pszVar, int *pnArray, int nSize, int nDefault);
815 bool NXCORE_EXPORTABLE ConfigWriteStr(const TCHAR *szVar, const TCHAR *szValue, bool bCreate, bool isVisible = true, bool needRestart = false);
816 bool NXCORE_EXPORTABLE ConfigWriteInt(const TCHAR *szVar, int iValue, bool bCreate, bool isVisible = true, bool needRestart = false);
817 bool NXCORE_EXPORTABLE ConfigWriteULong(const TCHAR *szVar, UINT32 dwValue, bool bCreate, bool isVisible = true, bool needRestart = false);
818 bool NXCORE_EXPORTABLE ConfigWriteByteArray(const TCHAR *pszVar, int *pnArray, int nSize, bool bCreate, bool isVisible = true, bool needRestart = false);
819 TCHAR NXCORE_EXPORTABLE *ConfigReadCLOB(const TCHAR *var, const TCHAR *defValue);
820 bool NXCORE_EXPORTABLE ConfigWriteCLOB(const TCHAR *var, const TCHAR *value, bool bCreate);
821 bool NXCORE_EXPORTABLE ConfigDelete(const TCHAR *name);
822
823 bool NXCORE_EXPORTABLE MetaDataReadStr(const TCHAR *szVar, TCHAR *szBuffer, int iBufSize, const TCHAR *szDefault);
824 INT32 NXCORE_EXPORTABLE MetaDataReadInt(const TCHAR *var, UINT32 defaultValue);
825
826 bool NXCORE_EXPORTABLE LoadConfig();
827
828 void NXCORE_EXPORTABLE Shutdown();
829 void NXCORE_EXPORTABLE FastShutdown();
830 BOOL NXCORE_EXPORTABLE Initialize();
831 THREAD_RESULT NXCORE_EXPORTABLE THREAD_CALL Main(void *);
832 void NXCORE_EXPORTABLE ShutdownDB();
833 void InitiateShutdown();
834
835 BOOL NXCORE_EXPORTABLE SleepAndCheckForShutdown(int iSeconds);
836
837 void ConsolePrintf(CONSOLE_CTX pCtx, const TCHAR *pszFormat, ...)
838 #if !defined(UNICODE) && (defined(__GNUC__) || defined(__clang__))
839 __attribute__ ((format(printf, 2, 3)))
840 #endif
841 ;
842 int ProcessConsoleCommand(const TCHAR *pszCmdLine, CONSOLE_CTX pCtx);
843
844 void SaveObjects(DB_HANDLE hdb);
845 void NXCORE_EXPORTABLE ObjectTransactionStart();
846 void NXCORE_EXPORTABLE ObjectTransactionEnd();
847
848 void NXCORE_EXPORTABLE QueueSQLRequest(const TCHAR *query);
849 void NXCORE_EXPORTABLE QueueSQLRequest(const TCHAR *query, int bindCount, int *sqlTypes, const TCHAR **values);
850 void QueueIDataInsert(time_t timestamp, UINT32 nodeId, UINT32 dciId, const TCHAR *value);
851 void QueueRawDciDataUpdate(time_t timestamp, UINT32 dciId, const TCHAR *rawValue, const TCHAR *transformedValue);
852 void StartDBWriter();
853 void StopDBWriter();
854
855 bool NXCORE_EXPORTABLE IsDatabaseRecordExist(DB_HANDLE hdb, const TCHAR *table, const TCHAR *idColumn, UINT32 id);
856
857 void DecodeSQLStringAndSetVariable(CSCPMessage *pMsg, UINT32 dwVarId, TCHAR *pszStr);
858
859 SNMP_SecurityContext *SnmpCheckCommSettings(SNMP_Transport *pTransport, int *version, SNMP_SecurityContext *originalContext, StringList *customTestOids);
860 void StrToMac(const TCHAR *pszStr, BYTE *pBuffer);
861
862 void InitLocalNetInfo();
863
864 ARP_CACHE *GetLocalArpCache();
865 ARP_CACHE *SnmpGetArpCache(UINT32 dwVersion, SNMP_Transport *pTransport);
866
867 InterfaceList *GetLocalInterfaceList();
868 void SnmpGetInterfaceStatus(UINT32 dwVersion, SNMP_Transport *pTransport, UINT32 dwIfIndex, int *adminState, int *operState);
869
870 ROUTING_TABLE *SnmpGetRoutingTable(UINT32 dwVersion, SNMP_Transport *pTransport);
871
872 void LoadNetworkDeviceDrivers();
873 NetworkDeviceDriver *FindDriverForNode(Node *node, SNMP_Transport *pTransport);
874 NetworkDeviceDriver *FindDriverByName(const TCHAR *name);
875 void AddDriverSpecificOids(StringList *list);
876
877 void WatchdogInit();
878 UINT32 WatchdogAddThread(const TCHAR *szName, time_t tNotifyInterval);
879 void WatchdogNotify(UINT32 dwId);
880 void WatchdogPrintStatus(CONSOLE_CTX pCtx);
881
882 void CheckForMgmtNode();
883 Node *PollNewNode(UINT32 dwIpAddr, UINT32 dwNetMask, UINT32 dwCreationFlags, WORD agentPort,
884 WORD snmpPort, const TCHAR *pszName, UINT32 dwProxyNode, UINT32 dwSNMPProxy, Cluster *pCluster,
885 UINT32 zoneId, bool doConfPoll, bool discoveredNode);
886
887 void NXCORE_EXPORTABLE EnumerateClientSessions(void (*pHandler)(ClientSession *, void *), void *pArg);
888 void NXCORE_EXPORTABLE NotifyClientSessions(UINT32 dwCode, UINT32 dwData);
889 int GetSessionCount(bool withRoot = true);
890 bool IsLoggedIn(UINT32 dwUserId);
891
892 void GetSysInfoStr(TCHAR *pszBuffer, int nMaxSize);
893 UINT32 GetLocalIpAddr();
894 TCHAR *GetLocalHostName(TCHAR *buffer, size_t bufSize);
895
896 BOOL ExecCommand(TCHAR *pszCommand);
897 BOOL SendMagicPacket(UINT32 dwIpAddr, BYTE *pbMacAddr, int iNumPackets);
898
899 BOOL InitIdTable();
900 UINT32 CreateUniqueId(int iGroup);
901 QWORD CreateUniqueEventId();
902 void SaveCurrentFreeId();
903
904 void InitMailer();
905 void ShutdownMailer();
906 void NXCORE_EXPORTABLE PostMail(const TCHAR *pszRcpt, const TCHAR *pszSubject, const TCHAR *pszText);
907
908 void InitSMSSender();
909 void ShutdownSMSSender();
910 void NXCORE_EXPORTABLE PostSMS(const TCHAR *pszRcpt, const TCHAR *pszText);
911
912 void InitTraps();
913 void SendTrapsToClient(ClientSession *pSession, UINT32 dwRqId);
914 void CreateTrapCfgMessage(CSCPMessage &msg);
915 UINT32 CreateNewTrap(UINT32 *pdwTrapId);
916 UINT32 CreateNewTrap(NXC_TRAP_CFG_ENTRY *pTrap);
917 UINT32 UpdateTrapFromMsg(CSCPMessage *pMsg);
918 UINT32 DeleteTrap(UINT32 dwId);
919 void CreateNXMPTrapRecord(String &str, UINT32 dwId);
920
921 BOOL IsTableTool(UINT32 dwToolId);
922 BOOL CheckObjectToolAccess(UINT32 dwToolId, UINT32 dwUserId);
923 UINT32 ExecuteTableTool(UINT32 dwToolId, Node *pNode, UINT32 dwRqId, ClientSession *pSession);
924 UINT32 DeleteObjectToolFromDB(UINT32 dwToolId);
925 UINT32 ChangeObjectToolStatus(UINT32 toolId, bool enabled);
926 UINT32 UpdateObjectToolFromMessage(CSCPMessage *pMsg);
927
928 UINT32 ModifySummaryTable(CSCPMessage *msg, LONG *newId);
929 UINT32 DeleteSummaryTable(LONG tableId);
930 Table *QuerySummaryTable(LONG tableId, UINT32 baseObjectId, UINT32 userId, UINT32 *rcc);
931
932 void CreateMessageFromSyslogMsg(CSCPMessage *pMsg, NX_SYSLOG_RECORD *pRec);
933 void ReinitializeSyslogParser();
934
935 void EscapeString(String &str);
936
937 void InitAuditLog();
938 void NXCORE_EXPORTABLE WriteAuditLog(const TCHAR *subsys, BOOL isSuccess, UINT32 userId,
939 const TCHAR *workstation, int sessionId, UINT32 objectId,
940 const TCHAR *format, ...);
941
942 bool ValidateConfig(Config *config, UINT32 flags, TCHAR *errorText, int errorTextLen);
943 UINT32 ImportConfig(Config *config, UINT32 flags);
944
945 #ifdef _WITH_ENCRYPTION
946 X509 *CertificateFromLoginMessage(CSCPMessage *pMsg);
947 BOOL ValidateUserCertificate(X509 *pCert, const TCHAR *pszLogin, BYTE *pChallenge,
948 BYTE *pSignature, UINT32 dwSigLen, int nMappingMethod,
949 const TCHAR *pszMappingData);
950 void ReloadCertificates();
951 #endif
952
953 #ifndef _WIN32
954 THREAD_RESULT NXCORE_EXPORTABLE THREAD_CALL SignalHandler(void *);
955 #endif /* not _WIN32 */
956
957 void DbgTestRWLock(RWLOCK hLock, const TCHAR *szName, CONSOLE_CTX pCtx);
958 void DumpClientSessions(CONSOLE_CTX pCtx);
959 void DumpMobileDeviceSessions(CONSOLE_CTX pCtx);
960 void ShowPollerState(CONSOLE_CTX pCtx);
961 void SetPollerInfo(int nIdx, const TCHAR *pszMsg);
962 void ShowServerStats(CONSOLE_CTX pCtx);
963 void ShowQueueStats(CONSOLE_CTX pCtx, Queue *pQueue, const TCHAR *pszName);
964 void DumpProcess(CONSOLE_CTX pCtx);
965
966 GRAPH_ACL_ENTRY *LoadGraphACL(DB_HANDLE hdb, UINT32 graphId, int *pnACLSize);
967 BOOL CheckGraphAccess(GRAPH_ACL_ENTRY *pACL, int nACLSize, UINT32 graphId, UINT32 graphUserId, UINT32 graphDesiredAccess);
968 UINT32 GetGraphAccessCheckResult(UINT32 graphId, UINT32 graphUserId);
969 GRAPH_ACL_AND_ID IsGraphNameExists(const TCHAR *graphName);
970
971 #if XMPP_SUPPORTED
972 bool SendXMPPMessage(const TCHAR *rcpt, const TCHAR *message);
973 #endif
974
975 /**
976 * File monitoring
977 */
978 struct MONITORED_FILE
979 {
980 TCHAR fileName[MAX_PATH];
981 ClientSession *session;
982 UINT32 nodeID;
983 };
984
985 class FileMonitoringList
986 {
987 private:
988 MUTEX m_mutex;
989 ObjectArray<MONITORED_FILE> m_monitoredFiles;
990 MONITORED_FILE* m_monitoredFile;
991
992 public:
993 FileMonitoringList();
994 ~FileMonitoringList();
995 void addMonitoringFile(MONITORED_FILE *fileForAdd);
996 bool checkDuplicate(MONITORED_FILE *fileForAdd);
997 ObjectArray<ClientSession>* findClientByFNameAndNodeID(const TCHAR *fileName, UINT32 nodeID);
998 bool removeMonitoringFile(MONITORED_FILE *fileForRemove);
999 void removeDisconectedNode(UINT32 nodeId);
1000
1001 private:
1002 void lock();
1003 void unlock();
1004 };
1005
1006 /**
1007 * Global variables
1008 */
1009 extern TCHAR NXCORE_EXPORTABLE g_szConfigFile[];
1010 extern TCHAR NXCORE_EXPORTABLE g_szLogFile[];
1011 extern UINT32 g_dwLogRotationMode;
1012 extern UINT32 g_dwMaxLogSize;
1013 extern UINT32 g_dwLogHistorySize;
1014 extern TCHAR g_szDailyLogFileSuffix[64];
1015 extern TCHAR NXCORE_EXPORTABLE g_szDumpDir[];
1016 extern TCHAR NXCORE_EXPORTABLE g_szListenAddress[];
1017 #ifndef _WIN32
1018 extern TCHAR NXCORE_EXPORTABLE g_szPIDFile[];
1019 #endif
1020 extern TCHAR g_szDataDir[];
1021 extern TCHAR g_szLibDir[];
1022 extern TCHAR g_szJavaLibDir[];
1023 extern UINT32 NXCORE_EXPORTABLE g_processAffinityMask;
1024 extern QWORD g_qwServerId;
1025 extern RSA *g_pServerKey;
1026 extern UINT32 g_icmpPingSize;
1027 extern UINT32 g_icmpPingTimeout;
1028 extern UINT32 g_auditFlags;
1029 extern time_t g_serverStartTime;
1030 extern UINT32 g_lockTimeout;
1031 extern UINT32 g_agentCommandTimeout;
1032 extern UINT32 g_thresholdRepeatInterval;
1033 extern int g_requiredPolls;
1034 extern UINT32 g_slmPollingInterval;
1035
1036 extern TCHAR g_szDbDriver[];
1037 extern TCHAR g_szDbDrvParams[];
1038 extern TCHAR g_szDbServer[];
1039 extern TCHAR g_szDbLogin[];
1040 extern TCHAR g_szDbPassword[];
1041 extern TCHAR g_szDbName[];
1042 extern TCHAR g_szDbSchema[];
1043 extern TCHAR NXCORE_EXPORTABLE g_szJavaPath[];
1044 extern DB_DRIVER g_dbDriver;
1045 extern DB_HANDLE NXCORE_EXPORTABLE g_hCoreDB;
1046 extern Queue *g_dbWriterQueue;
1047 extern Queue *g_dciDataWriterQueue;
1048 extern Queue *g_dciRawDataWriterQueue;
1049
1050 extern int NXCORE_EXPORTABLE g_dbSyntax;
1051 extern FileMonitoringList g_monitoringList;
1052
1053 #endif /* _nms_core_h_ */