- Database upgrade to V73
[public/netxms.git] / include / nms_util.h
CommitLineData
99e50bb7 1/* $Id: nms_util.h,v 1.114 2008-01-18 17:00:34 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
2391d4fd
VK
237 const String& operator =(const TCHAR *pszStr);
238 const String& operator +=(const TCHAR *pszStr);
8bad8476
VK
239 operator TCHAR*() { return CHECK_NULL_EX(m_pszBuffer); }
240
2391d4fd 241 void AddString(const TCHAR *pStr, DWORD dwLen);
c577e360
VK
242 void AddDynamicString(TCHAR *pszStr) { if (pszStr != NULL) { *this += pszStr; free(pszStr); } }
243
2391d4fd 244 void AddFormattedString(const TCHAR *pszFormat, ...);
8bad8476 245 void EscapeCharacter(int ch, int esc);
2391d4fd 246 void Translate(const TCHAR *pszSrc, const 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); }
2391d4fd 252 int Find(const TCHAR *pszStr, int nStart = 0);
c577e360
VK
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
99e50bb7 306#include <netxms_getopt.h>
3046f9a4
VK
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
3aa0061c 397 TCHAR LIBNETXMS_EXPORTABLE *nx_strncpy(TCHAR *pszDest, const TCHAR *pszSrc, int nLen);
c81979bc
VK
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);
3aa0061c 425 QWORD LIBNETXMS_EXPORTABLE FileSize(const TCHAR *pszFileName);
670c7f3d 426
64584976 427 int LIBNETXMS_EXPORTABLE BitsInMask(DWORD dwMask);
018fda4d 428 TCHAR LIBNETXMS_EXPORTABLE *IpToStr(DWORD dwAddr, TCHAR *szBuffer);
3aa0061c 429 DWORD LIBNETXMS_EXPORTABLE ResolveHostName(const 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);
3aa0061c 435 DWORD LIBNETXMS_EXPORTABLE StrToBin(const 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);
2391d4fd 442 int LIBNETXMS_EXPORTABLE NumChars(const TCHAR *pszStr, int ch);
f7794b68
VK
443#ifdef __cplusplus
444 BOOL LIBNETXMS_EXPORTABLE IsValidObjectName(const TCHAR *pszName, BOOL bExtendedChars = FALSE);
445#endif
fa2b47a7 446 BOOL LIBNETXMS_EXPORTABLE IsValidScriptName(const TCHAR *pszName);
2391d4fd 447 void LIBNETXMS_EXPORTABLE TranslateStr(TCHAR *pszString, const TCHAR *pszSubStr, const TCHAR *pszReplace);
257defd7 448 TCHAR LIBNETXMS_EXPORTABLE *GetCleanFileName(TCHAR *pszFileName);
c3cfc039 449 void LIBNETXMS_EXPORTABLE GetOSVersionString(TCHAR *pszBuffer, int nBufSize);
3aa0061c 450 BYTE LIBNETXMS_EXPORTABLE *LoadFile(const TCHAR *pszFileName, DWORD *pdwFileSize);
ec4995e6 451
6120112b 452 DWORD LIBNETXMS_EXPORTABLE CalculateCRC32(const unsigned char *pData, DWORD dwSize, DWORD dwCRC);
a3c76aba
VK
453 void LIBNETXMS_EXPORTABLE CalculateMD5Hash(const unsigned char *data, size_t nbytes, unsigned char *hash);
454 void LIBNETXMS_EXPORTABLE CalculateSHA1Hash(unsigned char *data, size_t nbytes, unsigned char *hash);
3aa0061c
VK
455 BOOL LIBNETXMS_EXPORTABLE CalculateFileMD5Hash(const TCHAR *pszFileName, BYTE *pHash);
456 BOOL LIBNETXMS_EXPORTABLE CalculateFileSHA1Hash(const TCHAR *pszFileName, BYTE *pHash);
457 BOOL LIBNETXMS_EXPORTABLE CalculateFileCRC32(const TCHAR *pszFileName, DWORD *pResult);
66c04cc7 458
46ef501a
VK
459 DWORD LIBNETXMS_EXPORTABLE IcmpPing(DWORD dwAddr, int iNumRetries, DWORD dwTimeout,
460 DWORD *pdwRTT, DWORD dwPacketSize);
4826c8a5 461
3aa0061c 462 DWORD LIBNETXMS_EXPORTABLE NxLoadConfig(const TCHAR *pszFileName, const TCHAR *pszSection,
6849d9be 463 NX_CFG_TEMPLATE *pTemplateList, BOOL bPrint);
3aa0061c 464 int LIBNETXMS_EXPORTABLE NxDCIDataTypeFromText(const TCHAR *pszText);
aa13cfd9 465
4560d8bd 466 HMODULE LIBNETXMS_EXPORTABLE DLOpen(const TCHAR *pszLibName, TCHAR *pszErrorText);
aa13cfd9 467 void LIBNETXMS_EXPORTABLE DLClose(HMODULE hModule);
4560d8bd 468 void LIBNETXMS_EXPORTABLE *DLGetSymbolAddr(HMODULE hModule, const TCHAR *pszSymbol, TCHAR *pszErrorText);
aa13cfd9 469
ae9cddaf 470 void LIBNETXMS_EXPORTABLE InitSubAgentsLogger(void (* pFunc)(int, TCHAR *));
15c8cf46 471 void LIBNETXMS_EXPORTABLE InitSubAgentsTrapSender(void (* pFunc1)(DWORD, int, TCHAR **),
a765d97c 472 void (* pFunc2)(DWORD, const char *, va_list));
ae9cddaf 473
aa13cfd9 474#ifdef _WIN32
018fda4d 475 TCHAR LIBNETXMS_EXPORTABLE *GetSystemErrorText(DWORD dwError, TCHAR *pszBuffer, int iBufSize);
aa13cfd9 476#endif
696fc54f
VK
477
478#if !(HAVE_DAEMON)
b1a57444 479 int LIBNETXMS_EXPORTABLE daemon(int nochdir, int noclose);
696fc54f 480#endif
4332e9d8 481
3aa0061c 482 DWORD LIBNETXMS_EXPORTABLE inet_addr_w(const WCHAR *pszAddr);
268774a0 483
4332e9d8 484#ifndef _WIN32
664c7c49 485 BOOL LIBNETXMS_EXPORTABLE SetDefaultCodepage(const char *cp);
3aa0061c 486 int LIBNETXMS_EXPORTABLE WideCharToMultiByte(int iCodePage, DWORD dwFlags, const WCHAR *pWideCharStr,
4332e9d8
VK
487 int cchWideChar, char *pByteStr, int cchByteChar,
488 char *pDefaultChar, BOOL *pbUsedDefChar);
3aa0061c 489 int LIBNETXMS_EXPORTABLE MultiByteToWideChar(int iCodePage, DWORD dwFlags, const char *pByteStr,
4332e9d8
VK
490 int cchByteChar, WCHAR *pWideCharStr,
491 int cchWideChar);
1738fb2b 492#if !HAVE_USEABLE_WCHAR
da27aabd 493 int LIBNETXMS_EXPORTABLE nx_wcslen(const WCHAR *pStr);
3aa0061c 494 WCHAR LIBNETXMS_EXPORTABLE *nx_wcsncpy(WCHAR *pDst, const WCHAR *pSrc, int nDstLen);
da27aabd 495 WCHAR LIBNETXMS_EXPORTABLE *nx_wcsdup(const WCHAR *pStr);
4332e9d8 496#endif
3e39fcde 497#endif /* _WIN32 */
3aa0061c
VK
498 WCHAR LIBNETXMS_EXPORTABLE *WideStringFromMBString(const char *pszString);
499 char LIBNETXMS_EXPORTABLE *MBStringFromWideString(const WCHAR *pwszString);
500 char LIBNETXMS_EXPORTABLE *UTF8StringFromWideString(const WCHAR *pwszString);
b50f1100 501
3d1058ed
VK
502#ifdef _WITH_ENCRYPTION
503 WCHAR LIBNETXMS_EXPORTABLE *ERR_error_string_W(int nError, WCHAR *pwszBuffer);
504#endif
505
dde96745
VK
506#ifdef UNICODE
507INT64 LIBNETXMS_EXPORTABLE wcstoll(const WCHAR *nptr, WCHAR **endptr, int base);
508QWORD LIBNETXMS_EXPORTABLE wcstoull(const WCHAR *nptr, WCHAR **endptr, int base);
509#else
b50f1100
VK
510#if !(HAVE_STRTOLL)
511 INT64 LIBNETXMS_EXPORTABLE strtoll(const char *nptr, char **endptr, int base);
512#endif
513#if !(HAVE_STRTOULL)
514 QWORD LIBNETXMS_EXPORTABLE strtoull(const char *nptr, char **endptr, int base);
515#endif
dde96745 516#endif
b50f1100 517
3d1cb7d6 518#ifdef _WIN32
37d62364 519#ifndef SWIGPERL
3d1cb7d6 520 DIR LIBNETXMS_EXPORTABLE *opendir(const char *filename);
7f9e0c00 521 struct dirent LIBNETXMS_EXPORTABLE *readdir(DIR *dirp);
3d1cb7d6
VK
522 int LIBNETXMS_EXPORTABLE closedir(DIR *dirp);
523#endif
37d62364 524#endif
3d1cb7d6 525
7f9e0c00
VK
526#if defined(_WIN32) || !(HAVE_SCANDIR)
527 int LIBNETXMS_EXPORTABLE scandir(const char *dir, struct dirent ***namelist,
528 int (*select)(const struct dirent *),
529 int (*compar)(const struct dirent **, const struct dirent **));
530 int LIBNETXMS_EXPORTABLE alphasort(const struct dirent **a, const struct dirent **b);
531#endif
532
55b33d4c
VK
533#ifdef UNDER_CE
534 int LIBNETXMS_EXPORTABLE _topen(TCHAR *pszName, int nFlags, ...);
535 int LIBNETXMS_EXPORTABLE read(int hFile, void *pBuffer, size_t nBytes);
536 int LIBNETXMS_EXPORTABLE write(int hFile, void *pBuffer, size_t nBytes);
537#endif
538
b71bff93 539#if !defined(_WIN32) && !defined(_NETWARE) && defined(NMS_THREADS_H_INCLUDED)
953dfe76 540void LIBNETXMS_EXPORTABLE StartMainLoop(THREAD_RESULT (THREAD_CALL * pfSignalHandler)(void *),
45c13da4 541 THREAD_RESULT (THREAD_CALL * pfMain)(void *));
953dfe76
VK
542#endif
543
b50f1100 544#ifdef __cplusplus
e9246d26 545}
b50f1100 546#endif
e9246d26
VK
547
548#endif /* _nms_util_h_ */
70fed300
AK
549
550///////////////////////////////////////////////////////////////////////////////
551/*
552
553$Log: not supported by cvs2svn $
99e50bb7
VK
554Revision 1.113 2007/12/05 14:17:23 victor
555
556SetDefaultCodePage now will check if codepage supported by iconv
557
664c7c49
VK
558Revision 1.112 2007/09/21 10:31:05 victor
559Fixed issue 185 (creting object with russion characters in name)
560
f7794b68
VK
561Revision 1.111 2007/09/20 13:03:59 victor
562- Most of GCC 4.2 warnings cleaned up
563- Other minor fixes
564
a765d97c
VK
565Revision 1.110 2007/07/25 12:03:05 victor
566More const char* fixes
567
3aa0061c
VK
568Revision 1.109 2007/07/25 11:27:36 victor
569Fixed some issues with char* -> const char* conversion
570
2391d4fd
VK
571Revision 1.108 2007/07/11 19:46:57 victor
572- New client source tree added
573- Minor changes in libraris for better support of new console
574
4560d8bd
VK
575Revision 1.107 2007/07/02 23:14:16 victor
576Various fixes
577
c3cfc039
VK
578Revision 1.106 2007/06/20 13:28:35 victor
579Fixed 'const char *' to 'char *' conversion error with some GCC versions
580
c90d3610
VK
581Revision 1.105 2007/05/15 09:36:32 victor
582Various improvements in web UI
583
fb7ce4b9
VK
584Revision 1.104 2007/05/11 15:44:46 victor
585- Added improved qsort()
586- Minor changes in web ui
587
b8a8d064
VK
588Revision 1.103 2007/05/07 11:35:41 victor
589- Unfinished changes in alarm generation code
590- nxhttpd redesigned
591
c577e360
VK
592Revision 1.102 2007/03/23 15:59:04 victor
593- All certificates now stored in database
594- CA certificates can be imported from management console
595- Fixed problems with some "invisible" system rights
596- Minor UI fixes
597
3d1058ed
VK
598Revision 1.101 2007/02/09 22:38:07 victor
599Crash dump generator added to console
600
ec4995e6
VK
601Revision 1.100 2007/01/24 00:52:28 alk
602Serial::ReadAll() added: read all data until timeout. returns data size, -1 it timeout w/o any data
603
f3a581d0
AK
604Revision 1.99 2007/01/11 18:56:14 victor
605- Added Process.COuntEx parameter
606- Added filtering by command line and window title to process.XXX parameters
607
ea1acec2
VK
608Revision 1.98 2006/12/17 10:31:37 victor
609ODBC driver made compatible with latest unixODBC
610
da27aabd
VK
611Revision 1.97 2006/12/11 21:19:27 victor
612Management pack creation almost working (only SNMP traps cannot be exported)
613
8bad8476
VK
614Revision 1.96 2006/11/03 08:58:56 victor
615- Added utillity class "Table"
616- Changed defines for iconv() usage on NetWare
617- Semi-complete "alarm details" view
618
ff214673
VK
619Revision 1.95 2006/10/17 21:20:25 victor
620Finished Implementation of agent traps and added trap sending API for subagents
621
15c8cf46
VK
622Revision 1.94 2006/10/05 05:24:05 victor
623Minor changes
624
5f461694
VK
625Revision 1.93 2006/10/01 20:43:37 victor
626UNICODE-related fixes
627
6cdccf82
VK
628Revision 1.92 2006/10/01 16:01:09 victor
629Yet another Linux UNICODE fix
630
556d9c45
VK
631Revision 1.91 2006/10/01 15:47:39 victor
632More UNICODE fixes
633
1738fb2b
VK
634Revision 1.90 2006/10/01 15:26:28 victor
635Some UNICODE-related fixes
636
3e39fcde
VK
637Revision 1.89 2006/09/30 22:41:08 victor
638Database driver API changed: now all SQL queries and results passed as UNICODE strings
639
7d4b78b3
VK
640Revision 1.88 2006/09/27 13:04:45 victor
641Preparation for process information parameters
642
ca6ad6bb
VK
643Revision 1.87 2006/09/27 04:15:25 victor
644AIX: implemented Net.InterfaceList
645
e25cadc9
VK
646Revision 1.86 2006/09/23 23:49:41 victor
647Console working with UNICODE!
648
dde96745
VK
649Revision 1.85 2006/09/10 06:59:36 victor
650Fixed problmes with Win32 build
651
6d8aee95
VK
652Revision 1.84 2006/09/07 22:02:06 alk
653UNIX version of Serial rewritten
654termio removed from configure (depricated in favour of termio_s_?)
655
70fed300
AK
656
657*/