SNMP library and tools on WIndows made UNICODE-only
[public/netxms.git] / include / nms_util.h
CommitLineData
e9246d26 1/*
7ac71e60 2** NetXMS - Network Management System
36e44abe 3** Copyright (C) 2003-2011 Victor Kirhenshtein
e9246d26
VK
4**
5** This program is free software; you can redistribute it and/or modify
68f384ea
VK
6** it under the terms of the GNU Lesser General Public License as published
7** by the Free Software Foundation; either version 3 of the License, or
e9246d26
VK
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**
68f384ea 15** You should have received a copy of the GNU Lesser General Public License
e9246d26
VK
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
fb7ce4b9 19** File: nms_util.h
e9246d26
VK
20**
21**/
22
23#ifndef _nms_util_h_
24#define _nms_util_h_
25
64584976
VK
26#ifdef _WIN32
27#ifdef LIBNETXMS_EXPORTS
28#define LIBNETXMS_EXPORTABLE __declspec(dllexport)
29#else
30#define LIBNETXMS_EXPORTABLE __declspec(dllimport)
31#endif
32#else /* _WIN32 */
33#define LIBNETXMS_EXPORTABLE
34#endif
35
36
e9246d26
VK
37#include <nms_common.h>
38#include <nms_cscp.h>
953dfe76 39#include <nms_threads.h>
64584976 40#include <time.h>
e9246d26 41
6d8aee95
VK
42#if HAVE_BYTESWAP_H
43#include <byteswap.h>
44#endif
45
92502d5f
VK
46#include <base64.h>
47
6d8aee95
VK
48
49//
92502d5f 50// Serial communications
6d8aee95
VK
51//
52
53#ifdef _WIN32
54
55#define FLOW_NONE 0
56#define FLOW_SOFTWARE 1
57#define FLOW_HARDWARE 2
58
59#else /* _WIN32 */
60
70fed300
AK
61#ifdef HAVE_TERMIOS_H
62# include <termios.h>
63#else
64# error termios.h not found
65#endif
66
6d8aee95
VK
67#endif /* _WIN32 */
68
69
66c04cc7
VK
70//
71// Return codes for IcmpPing()
72//
73
74#define ICMP_SUCCESS 0
75#define ICMP_UNREACHEABLE 1
76#define ICMP_TIMEOUT 2
77#define ICMP_RAW_SOCK_FAILED 3
416816ed 78#define ICMP_API_ERROR 3
66c04cc7
VK
79
80
dcb44c9a 81//
4826c8a5 82// Token types for configuration loader
dcb44c9a
VK
83//
84
4826c8a5
VK
85#define CT_LONG 0
86#define CT_STRING 1
87#define CT_STRING_LIST 2
88#define CT_END_OF_LIST 3
89#define CT_BOOLEAN 4
90#define CT_WORD 5
fc935a60 91#define CT_IGNORE 6
dda7c270 92#define CT_MB_STRING 7
4826c8a5
VK
93
94
95//
96// Return codes for NxLoadConfig()
97//
98
99#define NXCFG_ERR_OK 0
100#define NXCFG_ERR_NOFILE 1
101#define NXCFG_ERR_SYNTAX 2
102
103
9f2902ac
VK
104//
105// nxlog_open() flags
106//
107
108#define NXLOG_USE_SYSLOG ((DWORD)0x00000001)
109#define NXLOG_PRINT_TO_STDOUT ((DWORD)0x00000002)
110#define NXLOG_IS_OPEN ((DWORD)0x80000000)
111
112
5945d50a
VK
113//
114// nxlog rotation policy
115//
116
117#define NXLOG_ROTATION_DISABLED 0
118#define NXLOG_ROTATION_DAILY 1
119#define NXLOG_ROTATION_BY_SIZE 2
120
121
8ff13508 122//
35f836fe 123// _tcsdup() replacement
8ff13508
VK
124//
125
126#if defined(_WIN32) && defined(USE_WIN32_HEAP)
127#ifdef __cplusplus
128extern "C" {
129#endif
35f836fe 130char LIBNETXMS_EXPORTABLE *nx__tcsdup(const char *src);
8ff13508
VK
131WCHAR LIBNETXMS_EXPORTABLE *nx_wcsdup(const WCHAR *src);
132#ifdef __cplusplus
133}
134#endif
135#endif
136
137
b160350d
VK
138//
139// Class for serial communications
140//
141
142#ifdef __cplusplus
143
144#ifndef _WIN32
145enum
146{
147 NOPARITY,
148 ODDPARITY,
149 EVENPARITY,
150 ONESTOPBIT,
151 TWOSTOPBITS
152};
153
70fed300
AK
154enum
155{
156 FLOW_NONE,
157 FLOW_HARDWARE,
158 FLOW_SOFTWARE
159};
160
b160350d
VK
161#ifndef INVALID_HANDLE_VALUE
162#define INVALID_HANDLE_VALUE (-1)
163#endif
164#endif /* _WIN32 */
165
166class LIBNETXMS_EXPORTABLE Serial
167{
168public:
169 Serial(void);
170 ~Serial(void);
171
e2d68ddd 172 bool Open(const TCHAR *pszPort);
b160350d
VK
173 void Close(void);
174 void SetTimeout(int nTimeout);
f3a581d0
AK
175 int Read(char *pBuff, int nSize); /* waits up to timeout and do single read */
176 int ReadAll(char *pBuff, int nSize); /* read until timeout or out of space */
e2d68ddd 177 bool Write(const char *pBuff, int nSize);
b160350d
VK
178 void Flush(void);
179 bool Set(int nSpeed, int nDataBits, int nParity, int nStopBits);
70fed300 180 bool Set(int nSpeed, int nDataBits, int nParity, int nStopBits, int nFlowControl);
b160350d
VK
181 bool Restart(void);
182
183private:
184 TCHAR *m_pszPort;
185 int m_nTimeout;
186 int m_nSpeed;
187 int m_nDataBits;
188 int m_nStopBits;
189 int m_nParity;
70fed300 190 int m_nFlowControl;
b160350d
VK
191
192#ifndef _WIN32
193 int m_hPort;
70fed300 194 struct termios m_originalSettings;
b160350d
VK
195#else
196 HANDLE m_hPort;
197#endif
198};
199
ff214673
VK
200
201//
202// Class for table data storage
203//
204
ccc34207
VK
205class CSCPMessage;
206
ff214673
VK
207class LIBNETXMS_EXPORTABLE Table
208{
209private:
210 int m_nNumRows;
211 int m_nNumCols;
212 TCHAR **m_ppData;
213 TCHAR **m_ppColNames;
e31c8e60
VK
214 LONG *m_colFormats;
215 TCHAR *m_title;
ff214673
VK
216
217public:
218 Table();
ccc34207 219 Table(CSCPMessage *msg);
ff214673
VK
220 ~Table();
221
3d5610eb 222 int fillMessage(CSCPMessage &msg, int offset, int rowLimit);
9e126e57 223
e31c8e60
VK
224 int getNumRows() { return m_nNumRows; }
225 int getNumColumns() { return m_nNumCols; }
226 const TCHAR *getTitle() { return CHECK_NULL_EX(m_title); }
9e126e57 227
e31c8e60
VK
228 const TCHAR *getColumnName(int col) { return ((col >= 0) && (col < m_nNumCols)) ? m_ppColNames[col] : NULL; }
229 LONG getColumnFormat(int col) { return ((col >= 0) && (col < m_nNumCols)) ? m_colFormats[col] : 0; }
230
231 void setTitle(const TCHAR *title) { safe_free(m_title); m_title = (title != NULL) ? _tcsdup(title) : NULL; }
232 int addColumn(const TCHAR *name, LONG format = 0);
233 int addRow();
9e126e57
VK
234
235 void setAt(int nRow, int nCol, LONG nData);
236 void setAt(int nRow, int nCol, DWORD dwData);
237 void setAt(int nRow, int nCol, double dData);
238 void setAt(int nRow, int nCol, INT64 nData);
239 void setAt(int nRow, int nCol, QWORD qwData);
240 void setAt(int nRow, int nCol, const TCHAR *pszData);
241 void setPreallocatedAt(int nRow, int nCol, TCHAR *pszData);
242
243 void set(int nCol, LONG nData) { setAt(m_nNumRows - 1, nCol, nData); }
244 void set(int nCol, DWORD dwData) { setAt(m_nNumRows - 1, nCol, dwData); }
245 void set(int nCol, double dData) { setAt(m_nNumRows - 1, nCol, dData); }
246 void set(int nCol, INT64 nData) { setAt(m_nNumRows - 1, nCol, nData); }
247 void set(int nCol, QWORD qwData) { setAt(m_nNumRows - 1, nCol, qwData); }
248 void set(int nCol, const TCHAR *pszData) { setAt(m_nNumRows - 1, nCol, pszData); }
249 void setPreallocated(int nCol, TCHAR *pszData) { setPreallocatedAt(m_nNumRows - 1, nCol, pszData); }
250
251 const TCHAR *getAsString(int nRow, int nCol);
252 LONG getAsInt(int nRow, int nCol);
253 DWORD getAsUInt(int nRow, int nCol);
254 INT64 getAsInt64(int nRow, int nCol);
255 QWORD getAsUInt64(int nRow, int nCol);
256 double getAsDouble(int nRow, int nCol);
ff214673
VK
257};
258
8bad8476
VK
259
260//
261// Dynamic string class
262//
263
264class LIBNETXMS_EXPORTABLE String
265{
266protected:
267 TCHAR *m_pszBuffer;
268 DWORD m_dwBufSize;
269
270public:
c577e360
VK
271 static const int npos;
272
8bad8476 273 String();
f3cdd1c5 274 String(const TCHAR *init);
643c9dcb 275 String(const String &src);
8bad8476
VK
276 ~String();
277
7618e362 278 TCHAR *getBuffer() { return m_pszBuffer; }
ce7565e7 279 void setBuffer(TCHAR *pszBuffer);
8bad8476 280
2391d4fd 281 const String& operator =(const TCHAR *pszStr);
49bf9d8d 282 const String& operator =(const String &src);
2391d4fd 283 const String& operator +=(const TCHAR *pszStr);
ce7565e7 284 operator const TCHAR*() { return CHECK_NULL_EX(m_pszBuffer); }
8bad8476 285
08b214c6
VK
286 char *getUTF8String();
287
ce7565e7
VK
288 void addString(const TCHAR *pStr, DWORD dwLen);
289 void addDynamicString(TCHAR *pszStr) { if (pszStr != NULL) { *this += pszStr; free(pszStr); } }
c577e360 290
ce7565e7
VK
291 void addMultiByteString(const char *pStr, DWORD dwSize, int nCodePage);
292 void addWideCharString(const WCHAR *pStr, DWORD dwSize);
ff175e91 293
ce7565e7 294 void addFormattedString(const TCHAR *format, ...);
893dfdd7 295 void addFormattedStringV(const TCHAR *format, va_list args);
ce7565e7
VK
296 void escapeCharacter(int ch, int esc);
297 void translate(const TCHAR *pszSrc, const TCHAR *pszDst);
c577e360 298
ce7565e7
VK
299 DWORD getSize() { return m_dwBufSize > 0 ? m_dwBufSize - 1 : 0; }
300 BOOL isEmpty() { return m_dwBufSize <= 1; }
c577e360 301
ce7565e7
VK
302 TCHAR *subStr(int nStart, int nLen, TCHAR *pszBuffer);
303 TCHAR *subStr(int nStart, int nLen) { return subStr(nStart, nLen, NULL); }
304 int find(const TCHAR *pszStr, int nStart = 0);
1e1450ef 305
0bbab9d3
VK
306 void trim();
307 void shrink(int chars = 1);
c577e360
VK
308};
309
310
311//
312// String map class
313//
314
315class LIBNETXMS_EXPORTABLE StringMap
316{
317protected:
fb986055
VK
318 DWORD m_size;
319 TCHAR **m_keys;
320 TCHAR **m_values;
c577e360 321
fb986055 322 DWORD find(const TCHAR *key);
c577e360
VK
323
324public:
325 StringMap();
fb986055 326 StringMap(const StringMap &src);
c577e360
VK
327 ~StringMap();
328
fb986055 329 StringMap& operator =(const StringMap &src);
40b7416c 330
fb986055
VK
331 void set(const TCHAR *key, const TCHAR *value);
332 void setPreallocated(TCHAR *key, TCHAR *value);
5ad2167d
VK
333 void set(const TCHAR *key, DWORD value);
334
fb986055 335 const TCHAR *get(const TCHAR *key);
5ad2167d 336 DWORD getULong(const TCHAR *key, DWORD defaultValue);
6acb8479 337 bool getBoolean(const TCHAR *key, bool defaultValue);
5ad2167d 338
fb986055
VK
339 void remove(const TCHAR *key);
340 void clear();
c577e360 341
fb986055
VK
342 DWORD getSize() { return m_size; }
343 const TCHAR *getKeyByIndex(DWORD idx) { return (idx < m_size) ? CHECK_NULL_EX(m_keys[idx]) : NULL; }
344 const TCHAR *getValueByIndex(DWORD idx) { return (idx < m_size) ? CHECK_NULL_EX(m_values[idx]) : NULL; }
8bad8476
VK
345};
346
6173bea8
VK
347
348//
349// String list class
350//
351
352class LIBNETXMS_EXPORTABLE StringList
353{
354private:
355 int m_count;
356 int m_allocated;
357 TCHAR **m_values;
358
359public:
360 StringList();
361 ~StringList();
362
363 void add(const TCHAR *value);
364 void addPreallocated(TCHAR *value);
365 void add(LONG value);
366 void add(DWORD value);
367 void add(INT64 value);
368 void add(QWORD value);
369 void add(double value);
24dc5346 370 void replace(int index, const TCHAR *value);
6173bea8
VK
371 void clear();
372 int getSize() { return m_count; }
373 const TCHAR *getValue(int index) { return ((index >=0) && (index < m_count)) ? m_values[index] : NULL; }
ed806a1a
VK
374 int getIndex(const TCHAR *value);
375 int getIndexIgnoreCase(const TCHAR *value);
6173bea8
VK
376};
377
0d75ea88
VK
378
379//
380// Dynamic array class
381//
382
383class LIBNETXMS_EXPORTABLE Array
384{
385private:
386 int m_size;
387 int m_allocated;
388 int m_grow;
389 void **m_data;
390 bool m_objectOwner;
391
16d6f798 392 void internalRemove(int index, bool allowDestruction);
cfa7c21f 393 void destroyObject(void *object) { if (object != NULL) m_objectDestructor(object); }
16d6f798 394
0d75ea88 395protected:
cfa7c21f 396 void (*m_objectDestructor)(void *);
0d75ea88
VK
397
398public:
399 Array(int initial = 0, int grow = 16, bool owner = false);
400 virtual ~Array();
401
402 int add(void *object);
403 void *get(int index) { return ((index >= 0) && (index < m_size)) ? m_data[index] : NULL; }
47a89886 404 void set(int index, void *object);
24dc5346 405 void replace(int index, void *object);
16d6f798
VK
406 void remove(int index) { internalRemove(index, true); }
407 void unlink(int index) { internalRemove(index, false); }
0d75ea88
VK
408 void clear();
409
410 int size() { return m_size; }
411
412 void setOwner(bool owner) { m_objectOwner = owner; }
413 bool isOwner() { return m_objectOwner; }
414};
415
416template <class T> class ObjectArray : public Array
417{
cfa7c21f
VK
418private:
419 static void destructor(void *object) { delete (T*)object; }
0d75ea88
VK
420
421public:
cfa7c21f 422 ObjectArray(int initial = 0, int grow = 16, bool owner = false) : Array(initial, grow, owner) { m_objectDestructor = destructor; }
0d75ea88
VK
423 virtual ~ObjectArray() { }
424
47a89886 425 int add(T *object) { return Array::add((void *)object); }
0d75ea88 426 T *get(int index) { return (T*)Array::get(index); }
47a89886
VK
427 void set(int index, T *object) { Array::set(index, (void *)object); }
428 void replace(int index, T *object) { Array::replace(index, (void *)object); }
0d75ea88
VK
429};
430
7f632dfe 431
cc8ce218
VK
432//
433// Auxilliary class to hold dynamically allocated array of structures
434//
435
436template <class T> class StructArray
437{
438private:
439 int m_count;
440 T *m_data;
441
442public:
443 StructArray(T *data, int count) { m_data = data; m_count = count; }
444 ~StructArray() { safe_free(m_data); }
445
446 int size() { return m_count; }
447 T *get(int index) { return ((index >= 0) && (index < m_count)) ? &m_data[index] : NULL; }
448};
449
450
7f632dfe
VK
451//
452// Auxilliary class for objects which counts references and
453// destroys itself wheren reference count falls to 0
454//
455
456class LIBNETXMS_EXPORTABLE RefCountObject
457{
458private:
459 int m_refCount;
460 MUTEX m_mutex;
461
462public:
463 RefCountObject();
464 virtual ~RefCountObject();
465
466 void incRefCount();
467 void decRefCount();
468};
469
58ee2f43
VK
470
471//
472// Network connection
473//
474
475class LIBNETXMS_EXPORTABLE SocketConnection
476{
477protected:
478 SOCKET m_socket;
479 char m_data[4096];
480 int m_dataPos;
481
482public:
483 SocketConnection();
484 virtual ~SocketConnection();
485
486 bool connectTCP(const TCHAR *hostName, WORD port, DWORD timeout);
487 void disconnect();
488
489 bool canRead(DWORD timeout);
37a83e60 490 int read(char *pBuff, int nSize, DWORD timeout = INFINITE);
58ee2f43
VK
491 bool waitForText(const char *text, int timeout);
492
493 int write(const char *pBuff, int nSize);
1671f85d
VK
494 bool writeLine(const char *line);
495
496 static SocketConnection *createTCPConnection(const TCHAR *hostName, WORD port, DWORD timeout);
58ee2f43
VK
497};
498
b160350d
VK
499#endif /* __cplusplus */
500
501
4826c8a5
VK
502//
503// Configuration item template for configuration loader
504//
505
506typedef struct
507{
018fda4d 508 TCHAR szToken[64];
4826c8a5
VK
509 BYTE iType;
510 BYTE cSeparator; // Separator character for lists
511 WORD wListElements; // Number of list elements, should be set to 0 before calling NxLoadConfig()
512 DWORD dwBufferSize; // Buffer size for strings or flag to be set for CT_BOOLEAN
513 DWORD dwBufferPos; // Should be set to 0
514 void *pBuffer;
515} NX_CFG_TEMPLATE;
dcb44c9a
VK
516
517
bc858635
VK
518//
519// Code translation structure
520//
521
522typedef struct __CODE_TO_TEXT
523{
524 int code;
525 const TCHAR *text;
526} CODE_TO_TEXT;
527
528
3046f9a4
VK
529//
530// getopt() prototype if needed
531//
532
df9812a9 533#if USE_BUNDLED_GETOPT
99e50bb7 534#include <netxms_getopt.h>
3046f9a4
VK
535#endif
536
537
f2fdf1b5
VK
538//
539// Win32 API functions missing under WinCE
540//
541
c32b805a 542#if defined(UNDER_CE) && defined(__cplusplus)
f2fdf1b5
VK
543
544inline void GetSystemTimeAsFileTime(LPFILETIME pFt)
545{
546 SYSTEMTIME sysTime;
547
548 GetSystemTime(&sysTime);
549 SystemTimeToFileTime(&sysTime, pFt);
550}
551
552#endif // UNDER_CE
553
554
3d1cb7d6
VK
555//
556// Structures for opendir() / readdir() / closedir()
557//
558
559#ifdef _WIN32
560
7f9e0c00 561typedef struct dirent
3d1cb7d6
VK
562{
563 long d_ino; /* inode number (not used by MS-DOS) */
564 int d_namlen; /* Name length */
565 char d_name[257]; /* file name */
566} _DIRECT;
567
568typedef struct _dir_struc
569{
570 char *start; /* Starting position */
571 char *curr; /* Current position */
572 long size; /* Size of string table */
573 long nfiles; /* number if filenames in table */
7f9e0c00 574 struct dirent dirstr; /* Directory structure to return */
3d1cb7d6
VK
575} DIR;
576
5ea2db30
VK
577#ifdef UNICODE
578
579typedef struct dirent_w
580{
581 long d_ino; /* inode number (not used by MS-DOS) */
582 int d_namlen; /* Name length */
583 WCHAR d_name[257]; /* file name */
584} _DIRECTW;
585
586typedef struct _dir_struc_w
587{
588 WCHAR *start; /* Starting position */
589 WCHAR *curr; /* Current position */
590 long size; /* Size of string table */
591 long nfiles; /* number if filenames in table */
592 struct dirent_w dirstr; /* Directory structure to return */
593} DIRW;
594
595#define _TDIR DIRW
596#define _TDIRECT _DIRECTW
597#define _tdirent dirent_w
598
599#else
600
601#define _TDIR DIR
602#define _TDIRECT _DIRECT
603#define _tdirent dirent
604
37d62364
AK
605#endif
606
76b1d3d8
VK
607#else /* not _WIN32 */
608
609typedef struct dirent_w
610{
611 long d_ino; /* inode number */
612 WCHAR d_name[257]; /* file name */
613} _DIRECTW;
614
615typedef struct _dir_struc_w
616{
617 DIR *dir; /* Original non-unicode structure */
618 struct dirent_w dirstr; /* Directory structure to return */
619} DIRW;
620
3d1cb7d6
VK
621#endif /* _WIN32 */
622
623
e9246d26
VK
624//
625// Functions
626//
627
43d92b4c 628
babb8280 629#if WORDS_BIGENDIAN
43d92b4c
VK
630#define htonq(x) (x)
631#define ntohq(x) (x)
9f20696e
VK
632#define htond(x) (x)
633#define ntohd(x) (x)
babb8280
VK
634#define SwapWideString(x)
635#else
ca6ad6bb
VK
636#ifdef HAVE_HTONLL
637#define htonq(x) htonll(x)
638#else
babb8280 639#define htonq(x) __bswap_64(x)
ca6ad6bb
VK
640#endif
641#ifdef HAVE_NTOHLL
642#define ntohq(x) ntohll(x)
643#else
babb8280 644#define ntohq(x) __bswap_64(x)
ca6ad6bb 645#endif
babb8280
VK
646#define htond(x) __bswap_double(x)
647#define ntohd(x) __bswap_double(x)
648#define SwapWideString(x) __bswap_wstr(x)
43d92b4c 649#endif
15929b31 650
55b33d4c
VK
651#ifdef UNDER_CE
652#define close(x) CloseHandle((HANDLE)(x))
653#endif
654
c81979bc
VK
655#ifdef __cplusplus
656#ifndef LIBNETXMS_INLINE
4299401e 657 inline TCHAR *nx_strncpy(TCHAR *pszDest, const TCHAR *pszSrc, size_t nLen)
c81979bc 658 {
912b994d
VK
659#if defined(_WIN32) && (_MSC_VER >= 1400)
660 _tcsncpy_s(pszDest, nLen, pszSrc, _TRUNCATE);
661#else
c81979bc
VK
662 _tcsncpy(pszDest, pszSrc, nLen - 1);
663 pszDest[nLen - 1] = 0;
912b994d 664#endif
c81979bc
VK
665 return pszDest;
666 }
667#endif
668#else
7b8b337e
VK
669TCHAR LIBNETXMS_EXPORTABLE *nx_strncpy(TCHAR *pszDest, const TCHAR *pszSrc, size_t nLen);
670#endif
671
672#ifdef __cplusplus
673int LIBNETXMS_EXPORTABLE ConnectEx(SOCKET s, struct sockaddr *addr, int len, DWORD timeout);
674int LIBNETXMS_EXPORTABLE SendEx(SOCKET, const void *, size_t, int, MUTEX);
675int LIBNETXMS_EXPORTABLE RecvEx(SOCKET nSocket, const void *pBuff,
676 size_t nSize, int nFlags, DWORD dwTimeout);
c81979bc
VK
677#endif
678
b50f1100 679#ifdef __cplusplus
e9246d26
VK
680extern "C"
681{
b50f1100 682#endif
c5b523e2
VK
683#if defined(_WIN32) || !(HAVE_DECL___BSWAP_32)
684 DWORD LIBNETXMS_EXPORTABLE __bswap_32(DWORD dwVal);
685#endif
f52be742 686#if defined(_WIN32) || !(HAVE_DECL___BSWAP_64)
64584976
VK
687 QWORD LIBNETXMS_EXPORTABLE __bswap_64(QWORD qwVal);
688#endif
9f20696e 689 double LIBNETXMS_EXPORTABLE __bswap_double(double dVal);
273da39a 690 void LIBNETXMS_EXPORTABLE __bswap_wstr(UCS2CHAR *pStr);
64584976 691
076a55c4 692#if !defined(_WIN32) && !defined(_NETWARE)
8b86c5dc
VK
693#if defined(UNICODE_UCS2) || defined(UNICODE_UCS4)
694 void LIBNETXMS_EXPORTABLE wcsupr(WCHAR *in);
695#endif
696 void LIBNETXMS_EXPORTABLE strupr(char *in);
7e679c4b 697#endif
ab588c84 698
b8a8d064
VK
699 void LIBNETXMS_EXPORTABLE QSortEx(void *base, size_t nmemb, size_t size, void *arg,
700 int (*compare)(const void *, const void *, void *));
701
670c7f3d 702 INT64 LIBNETXMS_EXPORTABLE GetCurrentTimeMs(void);
3aa0061c 703 QWORD LIBNETXMS_EXPORTABLE FileSize(const TCHAR *pszFileName);
670c7f3d 704
64584976 705 int LIBNETXMS_EXPORTABLE BitsInMask(DWORD dwMask);
018fda4d 706 TCHAR LIBNETXMS_EXPORTABLE *IpToStr(DWORD dwAddr, TCHAR *szBuffer);
e0f99bf0
VK
707#ifdef UNICODE
708 char LIBNETXMS_EXPORTABLE *IpToStrA(DWORD dwAddr, char *szBuffer);
17b35ccc
VK
709#else
710#define IpToStrA IpToStr
e0f99bf0 711#endif
36e44abe 712 TCHAR LIBNETXMS_EXPORTABLE *Ip6ToStr(BYTE *addr, TCHAR *buffer);
60557d06
VK
713 TCHAR LIBNETXMS_EXPORTABLE *SockaddrToStr(struct sockaddr *addr, TCHAR *buffer);
714
3aa0061c 715 DWORD LIBNETXMS_EXPORTABLE ResolveHostName(const TCHAR *pszName);
08b214c6
VK
716#ifdef UNICODE
717 DWORD LIBNETXMS_EXPORTABLE ResolveHostNameA(const char *pszName);
718#else
719#define ResolveHostNameA ResolveHostName
720#endif
a1dc75b0 721
64584976 722 void LIBNETXMS_EXPORTABLE *nx_memdup(const void *pData, DWORD dwSize);
f218dc6d 723 void LIBNETXMS_EXPORTABLE nx_memswap(void *pBlock1, void *pBlock2, DWORD dwSize);
31521248 724
f42b8099 725 TCHAR LIBNETXMS_EXPORTABLE *BinToStr(const BYTE *pData, DWORD dwSize, TCHAR *pStr);
3aa0061c 726 DWORD LIBNETXMS_EXPORTABLE StrToBin(const TCHAR *pStr, BYTE *pData, DWORD dwSize);
f42b8099 727 TCHAR LIBNETXMS_EXPORTABLE *MACToStr(const BYTE *pData, TCHAR *pStr);
b50f1100 728
b07c50cc
VK
729 void LIBNETXMS_EXPORTABLE StrStripA(char *pszStr);
730 void LIBNETXMS_EXPORTABLE StrStripW(WCHAR *pszStr);
731#ifdef UNICODE
732#define StrStrip StrStripW
733#else
734#define StrStrip StrStripA
735#endif
736
0bbab9d3 737 void LIBNETXMS_EXPORTABLE Trim(TCHAR *str);
018fda4d 738 BOOL LIBNETXMS_EXPORTABLE MatchString(const TCHAR *pattern, const TCHAR *string, BOOL matchCase);
9eea20df 739 BOOL LIBNETXMS_EXPORTABLE RegexpMatch(const TCHAR *pszStr, const TCHAR *pszExpr, BOOL bMatchCase);
35f836fe 740 const TCHAR LIBNETXMS_EXPORTABLE *ExtractWord(const TCHAR *line, TCHAR *buffer);
f3cdd1c5 741 TCHAR LIBNETXMS_EXPORTABLE **SplitString(const TCHAR *source, TCHAR sep, int *numStrings);
3583a400
VK
742 int LIBNETXMS_EXPORTABLE NumCharsA(const char *pszStr, char ch);
743 int LIBNETXMS_EXPORTABLE NumCharsW(const WCHAR *pszStr, WCHAR ch);
744#ifdef UNICODE
745#define NumChars NumCharsW
746#else
747#define NumChars NumCharsA
748#endif
35f836fe
VK
749 void LIBNETXMS_EXPORTABLE RemoveTrailingCRLFA(char *str);
750 void LIBNETXMS_EXPORTABLE RemoveTrailingCRLFW(WCHAR *str);
751#ifdef UNICODE
752#define RemoveTrailingCRLF RemoveTrailingCRLFW
753#else
754#define RemoveTrailingCRLF RemoveTrailingCRLFA
755#endif
756
f7794b68
VK
757#ifdef __cplusplus
758 BOOL LIBNETXMS_EXPORTABLE IsValidObjectName(const TCHAR *pszName, BOOL bExtendedChars = FALSE);
759#endif
fa2b47a7 760 BOOL LIBNETXMS_EXPORTABLE IsValidScriptName(const TCHAR *pszName);
7618e362 761 /* deprecated */ void LIBNETXMS_EXPORTABLE TranslateStr(TCHAR *pszString, const TCHAR *pszSubStr, const TCHAR *pszReplace);
1a5e0c22 762 const TCHAR LIBNETXMS_EXPORTABLE *GetCleanFileName(const TCHAR *pszFileName);
c3cfc039 763 void LIBNETXMS_EXPORTABLE GetOSVersionString(TCHAR *pszBuffer, int nBufSize);
3aa0061c 764 BYTE LIBNETXMS_EXPORTABLE *LoadFile(const TCHAR *pszFileName, DWORD *pdwFileSize);
08b214c6
VK
765#ifdef UNICODE
766 BYTE LIBNETXMS_EXPORTABLE *LoadFileA(const char *pszFileName, DWORD *pdwFileSize);
767#else
768#define LoadFileA LoadFile
769#endif
770
6120112b 771 DWORD LIBNETXMS_EXPORTABLE CalculateCRC32(const unsigned char *pData, DWORD dwSize, DWORD dwCRC);
a3c76aba 772 void LIBNETXMS_EXPORTABLE CalculateMD5Hash(const unsigned char *data, size_t nbytes, unsigned char *hash);
e0d4b618 773 void LIBNETXMS_EXPORTABLE MD5HashForPattern(const unsigned char *data, size_t patternSize, size_t fullSize, BYTE *hash);
a3c76aba 774 void LIBNETXMS_EXPORTABLE CalculateSHA1Hash(unsigned char *data, size_t nbytes, unsigned char *hash);
e0d4b618 775 void LIBNETXMS_EXPORTABLE SHA1HashForPattern(unsigned char *data, size_t patternSize, size_t fullSize, unsigned char *hash);
3aa0061c
VK
776 BOOL LIBNETXMS_EXPORTABLE CalculateFileMD5Hash(const TCHAR *pszFileName, BYTE *pHash);
777 BOOL LIBNETXMS_EXPORTABLE CalculateFileSHA1Hash(const TCHAR *pszFileName, BYTE *pHash);
778 BOOL LIBNETXMS_EXPORTABLE CalculateFileCRC32(const TCHAR *pszFileName, DWORD *pResult);
66c04cc7 779
4e2debcc
VK
780 void LIBNETXMS_EXPORTABLE ICEEncryptData(const BYTE *in, int inLen, BYTE *out, const BYTE *key);
781 void LIBNETXMS_EXPORTABLE ICEDecryptData(const BYTE *in, int inLen, BYTE *out, const BYTE *key);
782
6b1282e7
VK
783 BOOL LIBNETXMS_EXPORTABLE DecryptPassword(const TCHAR *login, const TCHAR *encryptedPasswd, TCHAR *decryptedPasswd);
784
46ef501a
VK
785 DWORD LIBNETXMS_EXPORTABLE IcmpPing(DWORD dwAddr, int iNumRetries, DWORD dwTimeout,
786 DWORD *pdwRTT, DWORD dwPacketSize);
4826c8a5 787
e6c91aac
VK
788 /* deprecated:
789 DWORD LIBNETXMS_EXPORTABLE NxLoadConfig(const TCHAR *pszFileName, const TCHAR *pszSection,
790 NX_CFG_TEMPLATE *pTemplateList, BOOL bPrint);*/
3aa0061c 791 int LIBNETXMS_EXPORTABLE NxDCIDataTypeFromText(const TCHAR *pszText);
aa13cfd9 792
4560d8bd 793 HMODULE LIBNETXMS_EXPORTABLE DLOpen(const TCHAR *pszLibName, TCHAR *pszErrorText);
aa13cfd9 794 void LIBNETXMS_EXPORTABLE DLClose(HMODULE hModule);
dda7c270 795 void LIBNETXMS_EXPORTABLE *DLGetSymbolAddr(HMODULE hModule, const char *pszSymbol, TCHAR *pszErrorText);
aa13cfd9 796
2e06d08b
VK
797 BOOL LIBNETXMS_EXPORTABLE ExtractNamedOptionValue(const TCHAR *optString, const TCHAR *option, TCHAR *buffer, int bufSize);
798 BOOL LIBNETXMS_EXPORTABLE ExtractNamedOptionValueAsBool(const TCHAR *optString, const TCHAR *option, BOOL defVal);
799 long LIBNETXMS_EXPORTABLE ExtractNamedOptionValueAsInt(const TCHAR *optString, const TCHAR *option, long defVal);
ae9cddaf 800
bc858635
VK
801#ifdef __cplusplus
802 const TCHAR LIBNETXMS_EXPORTABLE *CodeToText(int iCode, CODE_TO_TEXT *pTranslator, const TCHAR *pszDefaultText = _T("Unknown"));
803#else
804 const TCHAR LIBNETXMS_EXPORTABLE *CodeToText(int iCode, CODE_TO_TEXT *pTranslator, const TCHAR *pszDefaultText);
805#endif
806
aa13cfd9 807#ifdef _WIN32
4299401e 808 TCHAR LIBNETXMS_EXPORTABLE *GetSystemErrorText(DWORD dwError, TCHAR *pszBuffer, size_t iBufSize);
ccc34207 809 BOOL LIBNETXMS_EXPORTABLE GetWindowsVersionString(TCHAR *versionString, int strSize);
11606542 810 INT64 LIBNETXMS_EXPORTABLE GetProcessRSS();
aa13cfd9 811#endif
696fc54f
VK
812
813#if !(HAVE_DAEMON)
b1a57444 814 int LIBNETXMS_EXPORTABLE daemon(int nochdir, int noclose);
696fc54f 815#endif
4332e9d8 816
3aa0061c 817 DWORD LIBNETXMS_EXPORTABLE inet_addr_w(const WCHAR *pszAddr);
268774a0 818
4332e9d8 819#ifndef _WIN32
664c7c49 820 BOOL LIBNETXMS_EXPORTABLE SetDefaultCodepage(const char *cp);
3aa0061c 821 int LIBNETXMS_EXPORTABLE WideCharToMultiByte(int iCodePage, DWORD dwFlags, const WCHAR *pWideCharStr,
4332e9d8
VK
822 int cchWideChar, char *pByteStr, int cchByteChar,
823 char *pDefaultChar, BOOL *pbUsedDefChar);
3aa0061c 824 int LIBNETXMS_EXPORTABLE MultiByteToWideChar(int iCodePage, DWORD dwFlags, const char *pByteStr,
4332e9d8
VK
825 int cchByteChar, WCHAR *pWideCharStr,
826 int cchWideChar);
04dbaf62 827
6b93c954 828#if !defined(UNICODE_UCS2) || !HAVE_WCSLEN
8b86c5dc 829 int LIBNETXMS_EXPORTABLE ucs2_strlen(const UCS2CHAR *pStr);
6b93c954
VK
830#endif
831#if !defined(UNICODE_UCS2) || !HAVE_WCSNCPY
8b86c5dc 832 UCS2CHAR LIBNETXMS_EXPORTABLE *ucs2_strncpy(UCS2CHAR *pDst, const UCS2CHAR *pSrc, int nDstLen);
6b93c954
VK
833#endif
834#if !defined(UNICODE_UCS2) || !HAVE_WCSDUP
35f836fe 835 UCS2CHAR LIBNETXMS_EXPORTABLE *ucs2__tcsdup(const UCS2CHAR *pStr);
4332e9d8 836#endif
8b86c5dc 837
53c96e2d
VK
838 size_t LIBNETXMS_EXPORTABLE ucs2_to_mb(const UCS2CHAR *src, int srcLen, char *dst, int dstLen);
839 size_t LIBNETXMS_EXPORTABLE mb_to_ucs2(const char *src, int srcLen, UCS2CHAR *dst, int dstLen);
39945910
VK
840 UCS2CHAR LIBNETXMS_EXPORTABLE *UCS2StringFromMBString(const char *pszString);
841 char LIBNETXMS_EXPORTABLE *MBStringFromUCS2String(const UCS2CHAR *pszString);
8b86c5dc 842
04dbaf62 843#ifdef UNICODE
6e17f325
VK
844 int LIBNETXMS_EXPORTABLE nx_wprintf(const WCHAR *format, ...);
845 int LIBNETXMS_EXPORTABLE nx_fwprintf(FILE *fp, const WCHAR *format, ...);
846 int LIBNETXMS_EXPORTABLE nx_swprintf(WCHAR *buffer, size_t size, const WCHAR *format, ...);
847 int LIBNETXMS_EXPORTABLE nx_vwprintf(const WCHAR *format, va_list args);
848 int LIBNETXMS_EXPORTABLE nx_vfwprintf(FILE *fp, const WCHAR *format, va_list args);
849 int LIBNETXMS_EXPORTABLE nx_vswprintf(WCHAR *buffer, size_t size, const WCHAR *format, va_list args);
04dbaf62
VK
850#endif
851
3e39fcde 852#endif /* _WIN32 */
8b86c5dc 853
3aa0061c 854 WCHAR LIBNETXMS_EXPORTABLE *WideStringFromMBString(const char *pszString);
c16afb3d 855 WCHAR LIBNETXMS_EXPORTABLE *WideStringFromUTF8String(const char *pszString);
3aa0061c
VK
856 char LIBNETXMS_EXPORTABLE *MBStringFromWideString(const WCHAR *pwszString);
857 char LIBNETXMS_EXPORTABLE *UTF8StringFromWideString(const WCHAR *pwszString);
8b86c5dc 858
3d1058ed
VK
859#ifdef _WITH_ENCRYPTION
860 WCHAR LIBNETXMS_EXPORTABLE *ERR_error_string_W(int nError, WCHAR *pwszBuffer);
861#endif
862
8b86c5dc 863#ifdef UNICODE_UCS4
53c96e2d
VK
864 size_t LIBNETXMS_EXPORTABLE ucs2_to_ucs4(const UCS2CHAR *src, int srcLen, WCHAR *dst, int dstLen);
865 size_t LIBNETXMS_EXPORTABLE ucs4_to_ucs2(const WCHAR *src, int srcLen, UCS2CHAR *dst, int dstLen);
866 size_t LIBNETXMS_EXPORTABLE ucs2_to_utf8(const UCS2CHAR *src, int srcLen, char *dst, int dstLen);
d9b66a56
VK
867 UCS2CHAR LIBNETXMS_EXPORTABLE *UCS2StringFromUCS4String(const WCHAR *pwszString);
868 WCHAR LIBNETXMS_EXPORTABLE *UCS4StringFromUCS2String(const UCS2CHAR *pszString);
b50f1100 869#endif
8b86c5dc 870
ef856d02 871#if defined(UNICODE) && !defined(_WIN32)
d9b66a56 872
8b86c5dc
VK
873#if !HAVE_WFOPEN
874 FILE LIBNETXMS_EXPORTABLE *wfopen(const WCHAR *_name, const WCHAR *_type);
875#endif
876#if !HAVE_WOPEN
877 int LIBNETXMS_EXPORTABLE wopen(const WCHAR *, int, ...);
b50f1100 878#endif
8b86c5dc
VK
879#if !HAVE_WSTAT
880 int wstat(const WCHAR *_path, struct stat *_sbuf);
dde96745 881#endif
b07c50cc
VK
882#if !HAVE_WCHDIR
883 int wchdir(const WCHAR *_path);
884#endif
885#if !HAVE_WMKDIR
886 int wmkdir(const WCHAR *_path, int mode);
887#endif
888#if !HAVE_WRMDIR
889 int wrmdir(const WCHAR *_path);
890#endif
ccc34207
VK
891#if !HAVE_WRENAME
892 int wrename(const WCHAR *_oldpath, const WCHAR *_newpath);
893#endif
894#if !HAVE_WUNLINK
895 int wunlink(const WCHAR *_path);
896#endif
b07c50cc
VK
897#if !HAVE_WREMOVE
898 int wremove(const WCHAR *_path);
899#endif
900#if !HAVE_WSYSTEM
901 int wsystem(const WCHAR *_cmd);
902#endif
dda7c270
VK
903#if !HAVE_WMKSTEMP
904 int wmkstemp(const WCHAR *_template);
905#endif
b07c50cc
VK
906#if !HAVE_WACCESS
907 int waccess(const WCHAR *_path, int mode);
908#endif
273da39a
VK
909#if !HAVE_WGETENV
910 WCHAR *wgetenv(const WCHAR *_string);
911#endif
d49d7500
VK
912#if !HAVE_WCSERROR && HAVE_STRERROR
913 WCHAR *wcserror(int errnum);
914#endif
915#if !HAVE_WCSERROR_R && HAVE_STRERROR_R
b0823d06
VK
916#if HAVE_POSIX_STRERROR_R
917 int wcserror_r(int errnum, WCHAR *strerrbuf, size_t buflen);
918#else
d49d7500
VK
919 WCHAR *wcserror_r(int errnum, WCHAR *strerrbuf, size_t buflen);
920#endif
b0823d06 921#endif
e05f8aaf 922
ef856d02 923#endif /* UNICODE && !_WIN32*/
e05f8aaf 924
8b86c5dc
VK
925#if !HAVE_STRTOLL
926 INT64 LIBNETXMS_EXPORTABLE strtoll(const char *nptr, char **endptr, int base);
927#endif
928#if !HAVE_STRTOULL
929 QWORD LIBNETXMS_EXPORTABLE strtoull(const char *nptr, char **endptr, int base);
930#endif
e05f8aaf
VK
931
932#if !HAVE_WCSTOLL
933 INT64 LIBNETXMS_EXPORTABLE wcstoll(const WCHAR *nptr, WCHAR **endptr, int base);
934#endif
935#if !HAVE_WCSTOULL
936 QWORD LIBNETXMS_EXPORTABLE wcstoull(const WCHAR *nptr, WCHAR **endptr, int base);
937#endif
b50f1100 938
fa88627b 939#if !HAVE_WCSDUP && !defined(_WIN32)
37861c72
VK
940 WCHAR LIBNETXMS_EXPORTABLE *wcsdup(const WCHAR *src);
941#endif
942
3d1cb7d6 943#ifdef _WIN32
5ea2db30
VK
944#ifdef UNICODE
945 DIRW LIBNETXMS_EXPORTABLE *wopendir(const WCHAR *filename);
946 struct dirent_w LIBNETXMS_EXPORTABLE *wreaddir(DIRW *dirp);
947 int LIBNETXMS_EXPORTABLE wclosedir(DIRW *dirp);
948
949#define _topendir wopendir
950#define _treaddir wreaddir
951#define _tclosedir wclosedir
952#else
953#define _topendir opendir
954#define _treaddir readdir
955#define _tclosedir closedir
956#endif
957
3d1cb7d6 958 DIR LIBNETXMS_EXPORTABLE *opendir(const char *filename);
7f9e0c00 959 struct dirent LIBNETXMS_EXPORTABLE *readdir(DIR *dirp);
3d1cb7d6 960 int LIBNETXMS_EXPORTABLE closedir(DIR *dirp);
5ea2db30 961
76b1d3d8
VK
962#else /* not _WIN32 */
963
964 DIRW LIBNETXMS_EXPORTABLE *wopendir(const WCHAR *filename);
965 struct dirent_w LIBNETXMS_EXPORTABLE *wreaddir(DIRW *dirp);
966 int LIBNETXMS_EXPORTABLE wclosedir(DIRW *dirp);
967
37d62364 968#endif
3d1cb7d6 969
7f9e0c00
VK
970#if defined(_WIN32) || !(HAVE_SCANDIR)
971 int LIBNETXMS_EXPORTABLE scandir(const char *dir, struct dirent ***namelist,
972 int (*select)(const struct dirent *),
973 int (*compar)(const struct dirent **, const struct dirent **));
974 int LIBNETXMS_EXPORTABLE alphasort(const struct dirent **a, const struct dirent **b);
975#endif
976
55b33d4c
VK
977#ifdef UNDER_CE
978 int LIBNETXMS_EXPORTABLE _topen(TCHAR *pszName, int nFlags, ...);
979 int LIBNETXMS_EXPORTABLE read(int hFile, void *pBuffer, size_t nBytes);
980 int LIBNETXMS_EXPORTABLE write(int hFile, void *pBuffer, size_t nBytes);
981#endif
982
9f2902ac 983BOOL LIBNETXMS_EXPORTABLE nxlog_open(const TCHAR *logName, DWORD flags, const TCHAR *msgModule,
d49d7500 984 unsigned int msgCount, const TCHAR **messages);
9f2902ac
VK
985void LIBNETXMS_EXPORTABLE nxlog_close(void);
986void LIBNETXMS_EXPORTABLE nxlog_write(DWORD msg, WORD wType, const char *format, ...);
5945d50a 987BOOL LIBNETXMS_EXPORTABLE nxlog_set_rotation_policy(int rotationMode, int maxLogSize, int historySize, const TCHAR *dailySuffix);
4addc3a3 988BOOL LIBNETXMS_EXPORTABLE nxlog_rotate();
f669df41
VK
989void LIBNETXMS_EXPORTABLE nxlog_set_console_writer(void (*writer)(const TCHAR *, ...));
990
991void LIBNETXMS_EXPORTABLE WriteToTerminal(const TCHAR *text);
992void LIBNETXMS_EXPORTABLE WriteToTerminalEx(const TCHAR *format, ...);
9f2902ac 993
37a7a862
VK
994#ifdef _WIN32
995int LIBNETXMS_EXPORTABLE mkstemp(char *tmpl);
996int LIBNETXMS_EXPORTABLE wmkstemp(WCHAR *tmpl);
997#ifdef UNICODE
998#define _tmkstemp wmkstemp
999#else
1000#define _tmkstemp mkstemp
1001#endif
1002#endif
1003
9b13553b
VK
1004#ifndef _WIN32
1005int strcat_s(char *dst, size_t dstSize, const char *src);
1006int wcscat_s(WCHAR *dst, size_t dstSize, const WCHAR *src);
1007#endif
1008
b50f1100 1009#ifdef __cplusplus
e9246d26 1010}
b50f1100 1011#endif
e9246d26 1012
a7ff20a5
VK
1013
1014//
1015// C++ only finctions
1016//
1017
1018#ifdef __cplusplus
1019
53c96e2d 1020TCHAR LIBNETXMS_EXPORTABLE *EscapeStringForXML(const TCHAR *string, int length);
a7ff20a5 1021String LIBNETXMS_EXPORTABLE EscapeStringForXML2(const TCHAR *string, int length = -1);
53c96e2d
VK
1022const char LIBNETXMS_EXPORTABLE *XMLGetAttr(const char **attrs, const char *name);
1023int LIBNETXMS_EXPORTABLE XMLGetAttrInt(const char **attrs, const char *name, int defVal);
1024DWORD LIBNETXMS_EXPORTABLE XMLGetAttrDWORD(const char **attrs, const char *name, DWORD defVal);
1025bool LIBNETXMS_EXPORTABLE XMLGetAttrBoolean(const char **attrs, const char *name, bool defVal);
1026
1027#if !defined(_WIN32) && !defined(_NETWARE) && defined(NMS_THREADS_H_INCLUDED)
1028void LIBNETXMS_EXPORTABLE StartMainLoop(THREAD_RESULT (THREAD_CALL * pfSignalHandler)(void *),
1029 THREAD_RESULT (THREAD_CALL * pfMain)(void *));
1030#endif
1031
1032void LIBNETXMS_EXPORTABLE InitSubAgentAPI(void (* writeLog)(int, int, const TCHAR *),
2dd24569
VK
1033 void (* sendTrap1)(DWORD, const TCHAR *, const char *, va_list),
1034 void (* sendTrap2)(DWORD, const TCHAR *, int, TCHAR **),
53c96e2d
VK
1035 BOOL (* sendFile)(void *, DWORD, const TCHAR *, long),
1036 BOOL (* pushData)(const TCHAR *, const TCHAR *));
a7ff20a5
VK
1037
1038#endif
1039
e9246d26 1040#endif /* _nms_util_h_ */