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