WEB update:
[public/netxms.git] / include / nms_util.h
CommitLineData
c3cfc039 1/* $Id: nms_util.h,v 1.107 2007-07-02 23:14:16 victor Exp $ */
e9246d26 2/*
7ac71e60 3** NetXMS - Network Management System
fb7ce4b9 4** Copyright (C) 2003, 2004, 2005, 2006, 2007 Victor Kirhenshtein
e9246d26
VK
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19**
fb7ce4b9 20** File: nms_util.h
e9246d26
VK
21**
22**/
23
24#ifndef _nms_util_h_
25#define _nms_util_h_
26
64584976
VK
27#ifdef _WIN32
28#ifdef LIBNETXMS_EXPORTS
29#define LIBNETXMS_EXPORTABLE __declspec(dllexport)
30#else
31#define LIBNETXMS_EXPORTABLE __declspec(dllimport)
32#endif
33#else /* _WIN32 */
34#define LIBNETXMS_EXPORTABLE
35#endif
36
37
e9246d26
VK
38#include <nms_common.h>
39#include <nms_cscp.h>
953dfe76 40#include <nms_threads.h>
64584976 41#include <time.h>
e9246d26 42
6d8aee95
VK
43#if HAVE_BYTESWAP_H
44#include <byteswap.h>
45#endif
46
47
48//
49// Sirial communications
50//
51
52#ifdef _WIN32
53
54#define FLOW_NONE 0
55#define FLOW_SOFTWARE 1
56#define FLOW_HARDWARE 2
57
58#else /* _WIN32 */
59
70fed300
AK
60#ifdef HAVE_TERMIOS_H
61# include <termios.h>
62#else
63# error termios.h not found
64#endif
65
6d8aee95
VK
66#endif /* _WIN32 */
67
68
69//
70// Common constants
71//
f52be742 72
5d63b3c1 73#define INVALID_INDEX 0xFFFFFFFF
28dd92c9 74#define CSCP_TEMP_BUF_SIZE 65536
89bfdd9c 75#define MD5_DIGEST_SIZE 16
d0b249a8 76#define SHA1_DIGEST_SIZE 20
5d63b3c1
VK
77
78
66c04cc7
VK
79//
80// Return codes for IcmpPing()
81//
82
83#define ICMP_SUCCESS 0
84#define ICMP_UNREACHEABLE 1
85#define ICMP_TIMEOUT 2
86#define ICMP_RAW_SOCK_FAILED 3
87
88
dcb44c9a 89//
4826c8a5 90// Token types for configuration loader
dcb44c9a
VK
91//
92
4826c8a5
VK
93#define CT_LONG 0
94#define CT_STRING 1
95#define CT_STRING_LIST 2
96#define CT_END_OF_LIST 3
97#define CT_BOOLEAN 4
98#define CT_WORD 5
fc935a60 99#define CT_IGNORE 6
4826c8a5
VK
100
101
102//
103// Return codes for NxLoadConfig()
104//
105
106#define NXCFG_ERR_OK 0
107#define NXCFG_ERR_NOFILE 1
108#define NXCFG_ERR_SYNTAX 2
109
110
b160350d
VK
111//
112// Class for serial communications
113//
114
115#ifdef __cplusplus
116
117#ifndef _WIN32
118enum
119{
120 NOPARITY,
121 ODDPARITY,
122 EVENPARITY,
123 ONESTOPBIT,
124 TWOSTOPBITS
125};
126
70fed300
AK
127enum
128{
129 FLOW_NONE,
130 FLOW_HARDWARE,
131 FLOW_SOFTWARE
132};
133
b160350d
VK
134#ifndef INVALID_HANDLE_VALUE
135#define INVALID_HANDLE_VALUE (-1)
136#endif
137#endif /* _WIN32 */
138
139class LIBNETXMS_EXPORTABLE Serial
140{
141public:
142 Serial(void);
143 ~Serial(void);
144
145 bool Open(TCHAR *pszPort);
146 void Close(void);
147 void SetTimeout(int nTimeout);
f3a581d0
AK
148 int Read(char *pBuff, int nSize); /* waits up to timeout and do single read */
149 int ReadAll(char *pBuff, int nSize); /* read until timeout or out of space */
b160350d
VK
150 bool Write(char *pBuff, int nSize);
151 void Flush(void);
152 bool Set(int nSpeed, int nDataBits, int nParity, int nStopBits);
70fed300 153 bool Set(int nSpeed, int nDataBits, int nParity, int nStopBits, int nFlowControl);
b160350d
VK
154 bool Restart(void);
155
156private:
157 TCHAR *m_pszPort;
158 int m_nTimeout;
159 int m_nSpeed;
160 int m_nDataBits;
161 int m_nStopBits;
162 int m_nParity;
70fed300 163 int m_nFlowControl;
b160350d
VK
164
165#ifndef _WIN32
166 int m_hPort;
70fed300 167 struct termios m_originalSettings;
b160350d
VK
168#else
169 HANDLE m_hPort;
170#endif
171};
172
ff214673
VK
173
174//
175// Class for table data storage
176//
177
178class LIBNETXMS_EXPORTABLE Table
179{
180private:
181 int m_nNumRows;
182 int m_nNumCols;
183 TCHAR **m_ppData;
184 TCHAR **m_ppColNames;
185
186public:
187 Table();
188 ~Table();
189
190 int GetNumRows(void) { return m_nNumRows; }
191 int GetNumColumns(void) { return m_nNumCols; }
192
193 void AddColumn(TCHAR *pszName);
194 void AddRow(void);
195
196 void SetAt(int nRow, int nCol, TCHAR *pszData);
197 void SetAt(int nRow, int nCol, LONG nData);
198 void SetAt(int nRow, int nCol, DWORD dwData);
199 void SetAt(int nRow, int nCol, double dData);
200 void SetAt(int nRow, int nCol, INT64 nData);
201 void SetAt(int nRow, int nCol, QWORD qwData);
202
203 void Set(int nCol, TCHAR *pszData) { SetAt(m_nNumRows - 1, nCol, pszData); }
204 void Set(int nCol, LONG nData) { SetAt(m_nNumRows - 1, nCol, nData); }
205 void Set(int nCol, DWORD dwData) { SetAt(m_nNumRows - 1, nCol, dwData); }
206 void Set(int nCol, double dData) { SetAt(m_nNumRows - 1, nCol, dData); }
207 void Set(int nCol, INT64 nData) { SetAt(m_nNumRows - 1, nCol, nData); }
208 void Set(int nCol, QWORD qwData) { SetAt(m_nNumRows - 1, nCol, qwData); }
209
210 TCHAR *GetAsString(int nRow, int nCol);
211 LONG GetAsInt(int nRow, int nCol);
212 DWORD GetAsUInt(int nRow, int nCol);
213 INT64 GetAsInt64(int nRow, int nCol);
214 QWORD GetAsUInt64(int nRow, int nCol);
215 double GetAsDouble(int nRow, int nCol);
216};
217
8bad8476
VK
218
219//
220// Dynamic string class
221//
222
223class LIBNETXMS_EXPORTABLE String
224{
225protected:
226 TCHAR *m_pszBuffer;
227 DWORD m_dwBufSize;
228
229public:
c577e360
VK
230 static const int npos;
231
8bad8476
VK
232 String();
233 ~String();
234
235 void SetBuffer(TCHAR *pszBuffer);
236
237 const String& operator =(TCHAR *pszStr);
238 const String& operator +=(TCHAR *pszStr);
239 operator TCHAR*() { return CHECK_NULL_EX(m_pszBuffer); }
240
c577e360
VK
241 void AddString(TCHAR *pStr, DWORD dwLen);
242 void AddDynamicString(TCHAR *pszStr) { if (pszStr != NULL) { *this += pszStr; free(pszStr); } }
243
8bad8476
VK
244 void AddFormattedString(TCHAR *pszFormat, ...);
245 void EscapeCharacter(int ch, int esc);
246 void Translate(TCHAR *pszSrc, TCHAR *pszDst);
c577e360
VK
247
248 DWORD Size(void) { return m_dwBufSize > 0 ? m_dwBufSize - 1 : 0; }
249
250 TCHAR *SubStr(int nStart, int nLen, TCHAR *pszBuffer);
251 TCHAR *SubStr(int nStart, int nLen) { return SubStr(nStart, nLen, NULL); }
252 int Find(TCHAR *pszStr, int nStart = 0);
253};
254
255
256//
257// String map class
258//
259
260class LIBNETXMS_EXPORTABLE StringMap
261{
262protected:
263 DWORD m_dwSize;
264 TCHAR **m_ppszKeys;
265 TCHAR **m_ppszValues;
266
c90d3610 267 DWORD Find(const TCHAR *pszKey);
c577e360
VK
268
269public:
270 StringMap();
271 ~StringMap();
272
c90d3610
VK
273 void Set(const TCHAR *pszKey, const TCHAR *pszValue);
274 TCHAR *Get(const TCHAR *pszKey);
c577e360
VK
275 void Clear(void);
276
277 DWORD Size(void) { return m_dwSize; }
278 TCHAR *GetKeyByIndex(DWORD idx) { return (idx < m_dwSize) ? m_ppszKeys[idx] : NULL; }
279 TCHAR *GetValueByIndex(DWORD idx) { return (idx < m_dwSize) ? m_ppszValues[idx] : NULL; }
8bad8476
VK
280};
281
b160350d
VK
282#endif /* __cplusplus */
283
284
4826c8a5
VK
285//
286// Configuration item template for configuration loader
287//
288
289typedef struct
290{
018fda4d 291 TCHAR szToken[64];
4826c8a5
VK
292 BYTE iType;
293 BYTE cSeparator; // Separator character for lists
294 WORD wListElements; // Number of list elements, should be set to 0 before calling NxLoadConfig()
295 DWORD dwBufferSize; // Buffer size for strings or flag to be set for CT_BOOLEAN
296 DWORD dwBufferPos; // Should be set to 0
297 void *pBuffer;
298} NX_CFG_TEMPLATE;
dcb44c9a
VK
299
300
3046f9a4
VK
301//
302// getopt() prototype if needed
303//
304
305#ifdef _WIN32
306#include <getopt.h>
307#endif
308
309
f2fdf1b5
VK
310//
311// Win32 API functions missing under WinCE
312//
313
c32b805a 314#if defined(UNDER_CE) && defined(__cplusplus)
f2fdf1b5
VK
315
316inline void GetSystemTimeAsFileTime(LPFILETIME pFt)
317{
318 SYSTEMTIME sysTime;
319
320 GetSystemTime(&sysTime);
321 SystemTimeToFileTime(&sysTime, pFt);
322}
323
324#endif // UNDER_CE
325
326
3d1cb7d6
VK
327//
328// Structures for opendir() / readdir() / closedir()
329//
330
331#ifdef _WIN32
332
37d62364
AK
333#ifndef SWIGPERL
334
7f9e0c00 335typedef struct dirent
3d1cb7d6
VK
336{
337 long d_ino; /* inode number (not used by MS-DOS) */
338 int d_namlen; /* Name length */
339 char d_name[257]; /* file name */
340} _DIRECT;
341
342typedef struct _dir_struc
343{
344 char *start; /* Starting position */
345 char *curr; /* Current position */
346 long size; /* Size of string table */
347 long nfiles; /* number if filenames in table */
7f9e0c00 348 struct dirent dirstr; /* Directory structure to return */
3d1cb7d6
VK
349} DIR;
350
37d62364
AK
351#endif
352
3d1cb7d6
VK
353#endif /* _WIN32 */
354
355
e9246d26
VK
356//
357// Functions
358//
359
43d92b4c 360
babb8280 361#if WORDS_BIGENDIAN
43d92b4c
VK
362#define htonq(x) (x)
363#define ntohq(x) (x)
9f20696e
VK
364#define htond(x) (x)
365#define ntohd(x) (x)
babb8280
VK
366#define SwapWideString(x)
367#else
ca6ad6bb
VK
368#ifdef HAVE_HTONLL
369#define htonq(x) htonll(x)
370#else
babb8280 371#define htonq(x) __bswap_64(x)
ca6ad6bb
VK
372#endif
373#ifdef HAVE_NTOHLL
374#define ntohq(x) ntohll(x)
375#else
babb8280 376#define ntohq(x) __bswap_64(x)
ca6ad6bb 377#endif
babb8280
VK
378#define htond(x) __bswap_double(x)
379#define ntohd(x) __bswap_double(x)
380#define SwapWideString(x) __bswap_wstr(x)
43d92b4c 381#endif
15929b31 382
55b33d4c
VK
383#ifdef UNDER_CE
384#define close(x) CloseHandle((HANDLE)(x))
385#endif
386
c81979bc
VK
387#ifdef __cplusplus
388#ifndef LIBNETXMS_INLINE
389 inline TCHAR *nx_strncpy(TCHAR *pszDest, const TCHAR *pszSrc, int nLen)
390 {
391 _tcsncpy(pszDest, pszSrc, nLen - 1);
392 pszDest[nLen - 1] = 0;
393 return pszDest;
394 }
395#endif
396#else
397 TCHAR LIBNETXMS_EXPORTABLE *nx_strncpy(TCHAR *pszDest, TCHAR *pszSrc, int nLen);
398#endif
399
b50f1100 400#ifdef __cplusplus
e9246d26
VK
401extern "C"
402{
b50f1100 403#endif
08043edf
VK
404 int LIBNETXMS_EXPORTABLE SendEx(SOCKET, const void *, size_t, int);
405 int LIBNETXMS_EXPORTABLE RecvEx(SOCKET nSocket, const void *pBuff,
406 size_t nSize, int nFlags, DWORD dwTimeout);
b24955fb 407
c5b523e2
VK
408#if defined(_WIN32) || !(HAVE_DECL___BSWAP_32)
409 DWORD LIBNETXMS_EXPORTABLE __bswap_32(DWORD dwVal);
410#endif
f52be742 411#if defined(_WIN32) || !(HAVE_DECL___BSWAP_64)
64584976
VK
412 QWORD LIBNETXMS_EXPORTABLE __bswap_64(QWORD qwVal);
413#endif
9f20696e 414 double LIBNETXMS_EXPORTABLE __bswap_double(double dVal);
babb8280 415 void LIBNETXMS_EXPORTABLE __bswap_wstr(WCHAR *pStr);
64584976 416
076a55c4 417#if !defined(_WIN32) && !defined(_NETWARE)
018fda4d 418 void LIBNETXMS_EXPORTABLE strupr(TCHAR *in);
7e679c4b 419#endif
ab588c84 420
b8a8d064
VK
421 void LIBNETXMS_EXPORTABLE QSortEx(void *base, size_t nmemb, size_t size, void *arg,
422 int (*compare)(const void *, const void *, void *));
423
670c7f3d 424 INT64 LIBNETXMS_EXPORTABLE GetCurrentTimeMs(void);
ddce77b0 425 QWORD LIBNETXMS_EXPORTABLE FileSize(TCHAR *pszFileName);
670c7f3d 426
64584976 427 int LIBNETXMS_EXPORTABLE BitsInMask(DWORD dwMask);
018fda4d 428 TCHAR LIBNETXMS_EXPORTABLE *IpToStr(DWORD dwAddr, TCHAR *szBuffer);
d0fc56c6 429 DWORD LIBNETXMS_EXPORTABLE ResolveHostName(TCHAR *pszName);
a1dc75b0 430
64584976 431 void LIBNETXMS_EXPORTABLE *nx_memdup(const void *pData, DWORD dwSize);
f218dc6d 432 void LIBNETXMS_EXPORTABLE nx_memswap(void *pBlock1, void *pBlock2, DWORD dwSize);
31521248 433
e25cadc9 434 TCHAR LIBNETXMS_EXPORTABLE *BinToStr(BYTE *pData, DWORD dwSize, TCHAR *pStr);
4075c782 435 DWORD LIBNETXMS_EXPORTABLE StrToBin(TCHAR *pStr, BYTE *pData, DWORD dwSize);
c61f5190 436 void LIBNETXMS_EXPORTABLE MACToStr(BYTE *pData, TCHAR *pStr);
b50f1100 437
018fda4d
AK
438 void LIBNETXMS_EXPORTABLE StrStrip(TCHAR *pszStr);
439 BOOL LIBNETXMS_EXPORTABLE MatchString(const TCHAR *pattern, const TCHAR *string, BOOL matchCase);
ea1acec2 440 BOOL LIBNETXMS_EXPORTABLE RegexpMatch(TCHAR *pszStr, TCHAR *pszExpr, BOOL bMatchCase);
018fda4d 441 TCHAR LIBNETXMS_EXPORTABLE *ExtractWord(TCHAR *line, TCHAR *buffer);
8bad8476 442 int LIBNETXMS_EXPORTABLE NumChars(TCHAR *pszStr, int ch);
fa2b47a7
VK
443 BOOL LIBNETXMS_EXPORTABLE IsValidObjectName(const TCHAR *pszName);
444 BOOL LIBNETXMS_EXPORTABLE IsValidScriptName(const TCHAR *pszName);
ff5e8be5 445 void LIBNETXMS_EXPORTABLE TranslateStr(TCHAR *pszString, TCHAR *pszSubStr, TCHAR *pszReplace);
257defd7 446 TCHAR LIBNETXMS_EXPORTABLE *GetCleanFileName(TCHAR *pszFileName);
c3cfc039 447 void LIBNETXMS_EXPORTABLE GetOSVersionString(TCHAR *pszBuffer, int nBufSize);
ec4995e6
VK
448 BYTE LIBNETXMS_EXPORTABLE *LoadFile(TCHAR *pszFileName, DWORD *pdwFileSize);
449
6120112b 450 DWORD LIBNETXMS_EXPORTABLE CalculateCRC32(const unsigned char *pData, DWORD dwSize, DWORD dwCRC);
a3c76aba
VK
451 void LIBNETXMS_EXPORTABLE CalculateMD5Hash(const unsigned char *data, size_t nbytes, unsigned char *hash);
452 void LIBNETXMS_EXPORTABLE CalculateSHA1Hash(unsigned char *data, size_t nbytes, unsigned char *hash);
b40371d4
AK
453 BOOL LIBNETXMS_EXPORTABLE CalculateFileMD5Hash(TCHAR *pszFileName, BYTE *pHash);
454 BOOL LIBNETXMS_EXPORTABLE CalculateFileSHA1Hash(TCHAR *pszFileName, BYTE *pHash);
6120112b 455 BOOL LIBNETXMS_EXPORTABLE CalculateFileCRC32(TCHAR *pszFileName, DWORD *pResult);
66c04cc7 456
46ef501a
VK
457 DWORD LIBNETXMS_EXPORTABLE IcmpPing(DWORD dwAddr, int iNumRetries, DWORD dwTimeout,
458 DWORD *pdwRTT, DWORD dwPacketSize);
4826c8a5 459
018fda4d 460 DWORD LIBNETXMS_EXPORTABLE NxLoadConfig(TCHAR *pszFileName, TCHAR *pszSection,
6849d9be 461 NX_CFG_TEMPLATE *pTemplateList, BOOL bPrint);
125c0e81 462 int LIBNETXMS_EXPORTABLE NxDCIDataTypeFromText(TCHAR *pszText);
aa13cfd9 463
018fda4d 464 HMODULE LIBNETXMS_EXPORTABLE DLOpen(TCHAR *szLibName, TCHAR *pszErrorText);
aa13cfd9 465 void LIBNETXMS_EXPORTABLE DLClose(HMODULE hModule);
018fda4d 466 void LIBNETXMS_EXPORTABLE *DLGetSymbolAddr(HMODULE hModule, TCHAR *szSymbol, TCHAR *pszErrorText);
aa13cfd9 467
ae9cddaf 468 void LIBNETXMS_EXPORTABLE InitSubAgentsLogger(void (* pFunc)(int, TCHAR *));
15c8cf46
VK
469 void LIBNETXMS_EXPORTABLE InitSubAgentsTrapSender(void (* pFunc1)(DWORD, int, TCHAR **),
470 void (* pFunc2)(DWORD, char *, va_list));
ae9cddaf 471
aa13cfd9 472#ifdef _WIN32
018fda4d 473 TCHAR LIBNETXMS_EXPORTABLE *GetSystemErrorText(DWORD dwError, TCHAR *pszBuffer, int iBufSize);
aa13cfd9 474#endif
696fc54f
VK
475
476#if !(HAVE_DAEMON)
b1a57444 477 int LIBNETXMS_EXPORTABLE daemon(int nochdir, int noclose);
696fc54f 478#endif
4332e9d8 479
268774a0
VK
480 DWORD LIBNETXMS_EXPORTABLE inet_addr_w(WCHAR *pszAddr);
481
4332e9d8 482#ifndef _WIN32
5f461694 483 void LIBNETXMS_EXPORTABLE SetDefaultCodepage(char *cp);
4332e9d8
VK
484 int LIBNETXMS_EXPORTABLE WideCharToMultiByte(int iCodePage, DWORD dwFlags, WCHAR *pWideCharStr,
485 int cchWideChar, char *pByteStr, int cchByteChar,
486 char *pDefaultChar, BOOL *pbUsedDefChar);
487 int LIBNETXMS_EXPORTABLE MultiByteToWideChar(int iCodePage, DWORD dwFlags, char *pByteStr,
488 int cchByteChar, WCHAR *pWideCharStr,
489 int cchWideChar);
1738fb2b 490#if !HAVE_USEABLE_WCHAR
da27aabd
VK
491 int LIBNETXMS_EXPORTABLE nx_wcslen(const WCHAR *pStr);
492 WCHAR LIBNETXMS_EXPORTABLE *nx_wcsncpy(WCHAR *pDst, WCHAR *pSrc, int nDstLen);
493 WCHAR LIBNETXMS_EXPORTABLE *nx_wcsdup(const WCHAR *pStr);
4332e9d8 494#endif
3e39fcde 495#endif /* _WIN32 */
7d4b78b3
VK
496 WCHAR LIBNETXMS_EXPORTABLE *WideStringFromMBString(char *pszString);
497 char LIBNETXMS_EXPORTABLE *MBStringFromWideString(WCHAR *pwszString);
498 char LIBNETXMS_EXPORTABLE *UTF8StringFromWideString(WCHAR *pwszString);
b50f1100 499
3d1058ed
VK
500#ifdef _WITH_ENCRYPTION
501 WCHAR LIBNETXMS_EXPORTABLE *ERR_error_string_W(int nError, WCHAR *pwszBuffer);
502#endif
503
dde96745
VK
504#ifdef UNICODE
505INT64 LIBNETXMS_EXPORTABLE wcstoll(const WCHAR *nptr, WCHAR **endptr, int base);
506QWORD LIBNETXMS_EXPORTABLE wcstoull(const WCHAR *nptr, WCHAR **endptr, int base);
507#else
b50f1100
VK
508#if !(HAVE_STRTOLL)
509 INT64 LIBNETXMS_EXPORTABLE strtoll(const char *nptr, char **endptr, int base);
510#endif
511#if !(HAVE_STRTOULL)
512 QWORD LIBNETXMS_EXPORTABLE strtoull(const char *nptr, char **endptr, int base);
513#endif
dde96745 514#endif
b50f1100 515
3d1cb7d6 516#ifdef _WIN32
37d62364 517#ifndef SWIGPERL
3d1cb7d6 518 DIR LIBNETXMS_EXPORTABLE *opendir(const char *filename);
7f9e0c00 519 struct dirent LIBNETXMS_EXPORTABLE *readdir(DIR *dirp);
3d1cb7d6
VK
520 int LIBNETXMS_EXPORTABLE closedir(DIR *dirp);
521#endif
37d62364 522#endif
3d1cb7d6 523
7f9e0c00
VK
524#if defined(_WIN32) || !(HAVE_SCANDIR)
525 int LIBNETXMS_EXPORTABLE scandir(const char *dir, struct dirent ***namelist,
526 int (*select)(const struct dirent *),
527 int (*compar)(const struct dirent **, const struct dirent **));
528 int LIBNETXMS_EXPORTABLE alphasort(const struct dirent **a, const struct dirent **b);
529#endif
530
55b33d4c
VK
531#ifdef UNDER_CE
532 int LIBNETXMS_EXPORTABLE _topen(TCHAR *pszName, int nFlags, ...);
533 int LIBNETXMS_EXPORTABLE read(int hFile, void *pBuffer, size_t nBytes);
534 int LIBNETXMS_EXPORTABLE write(int hFile, void *pBuffer, size_t nBytes);
535#endif
536
b71bff93 537#if !defined(_WIN32) && !defined(_NETWARE) && defined(NMS_THREADS_H_INCLUDED)
953dfe76 538void LIBNETXMS_EXPORTABLE StartMainLoop(THREAD_RESULT (THREAD_CALL * pfSignalHandler)(void *),
45c13da4 539 THREAD_RESULT (THREAD_CALL * pfMain)(void *));
953dfe76
VK
540#endif
541
b50f1100 542#ifdef __cplusplus
e9246d26 543}
b50f1100 544#endif
e9246d26
VK
545
546#endif /* _nms_util_h_ */
70fed300
AK
547
548///////////////////////////////////////////////////////////////////////////////
549/*
550
551$Log: not supported by cvs2svn $
c3cfc039
VK
552Revision 1.106 2007/06/20 13:28:35 victor
553Fixed 'const char *' to 'char *' conversion error with some GCC versions
554
c90d3610
VK
555Revision 1.105 2007/05/15 09:36:32 victor
556Various improvements in web UI
557
fb7ce4b9
VK
558Revision 1.104 2007/05/11 15:44:46 victor
559- Added improved qsort()
560- Minor changes in web ui
561
b8a8d064
VK
562Revision 1.103 2007/05/07 11:35:41 victor
563- Unfinished changes in alarm generation code
564- nxhttpd redesigned
565
c577e360
VK
566Revision 1.102 2007/03/23 15:59:04 victor
567- All certificates now stored in database
568- CA certificates can be imported from management console
569- Fixed problems with some "invisible" system rights
570- Minor UI fixes
571
3d1058ed
VK
572Revision 1.101 2007/02/09 22:38:07 victor
573Crash dump generator added to console
574
ec4995e6
VK
575Revision 1.100 2007/01/24 00:52:28 alk
576Serial::ReadAll() added: read all data until timeout. returns data size, -1 it timeout w/o any data
577
f3a581d0
AK
578Revision 1.99 2007/01/11 18:56:14 victor
579- Added Process.COuntEx parameter
580- Added filtering by command line and window title to process.XXX parameters
581
ea1acec2
VK
582Revision 1.98 2006/12/17 10:31:37 victor
583ODBC driver made compatible with latest unixODBC
584
da27aabd
VK
585Revision 1.97 2006/12/11 21:19:27 victor
586Management pack creation almost working (only SNMP traps cannot be exported)
587
8bad8476
VK
588Revision 1.96 2006/11/03 08:58:56 victor
589- Added utillity class "Table"
590- Changed defines for iconv() usage on NetWare
591- Semi-complete "alarm details" view
592
ff214673
VK
593Revision 1.95 2006/10/17 21:20:25 victor
594Finished Implementation of agent traps and added trap sending API for subagents
595
15c8cf46
VK
596Revision 1.94 2006/10/05 05:24:05 victor
597Minor changes
598
5f461694
VK
599Revision 1.93 2006/10/01 20:43:37 victor
600UNICODE-related fixes
601
6cdccf82
VK
602Revision 1.92 2006/10/01 16:01:09 victor
603Yet another Linux UNICODE fix
604
556d9c45
VK
605Revision 1.91 2006/10/01 15:47:39 victor
606More UNICODE fixes
607
1738fb2b
VK
608Revision 1.90 2006/10/01 15:26:28 victor
609Some UNICODE-related fixes
610
3e39fcde
VK
611Revision 1.89 2006/09/30 22:41:08 victor
612Database driver API changed: now all SQL queries and results passed as UNICODE strings
613
7d4b78b3
VK
614Revision 1.88 2006/09/27 13:04:45 victor
615Preparation for process information parameters
616
ca6ad6bb
VK
617Revision 1.87 2006/09/27 04:15:25 victor
618AIX: implemented Net.InterfaceList
619
e25cadc9
VK
620Revision 1.86 2006/09/23 23:49:41 victor
621Console working with UNICODE!
622
dde96745
VK
623Revision 1.85 2006/09/10 06:59:36 victor
624Fixed problmes with Win32 build
625
6d8aee95
VK
626Revision 1.84 2006/09/07 22:02:06 alk
627UNIX version of Serial rewritten
628termio removed from configure (depricated in favour of termio_s_?)
629
70fed300
AK
630
631*/