libnxsrv and nxcore moved to VS2005 (nxcore cannot be linked because libnxsl not...
[public/netxms.git] / include / nms_common.h
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2003, 2004, 2005, 2006, 2007 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_common.h
20 **
21 **/
22
23 #ifndef _nms_common_h_
24 #define _nms_common_h_
25
26 #ifdef WIN32
27 #ifndef _WIN32
28 #define _WIN32
29 #endif
30 #endif
31
32 #if !defined(_WIN32) && !defined(UNDER_CE)
33 #ifdef _NETWARE
34 #include <config-netware.h>
35 #else
36 #include "config.h"
37 #ifdef WITH_OPENSSL
38 #define _WITH_ENCRYPTION 1
39 #endif
40 #endif
41 #else /* _WIN32 */
42 #ifndef UNDER_CE
43 #define _WITH_ENCRYPTION 1
44 #endif
45 #define _CRT_SECURE_NO_DEPRECATE
46 #endif
47
48 #ifdef HAVE_STDARG_H
49 # include <stdarg.h>
50 #endif
51
52 #include <unicode.h>
53 #include <stdio.h>
54 #include <string.h>
55 #include <limits.h>
56
57 #include <netxms-version.h>
58
59
60 //
61 // Define __64BIT__ if compiling for 64bit platform with Visual C++
62 //
63
64 #if defined(_M_X64) || defined(_M_IA64)
65 #ifndef __64BIT__
66 #define __64BIT__
67 #endif
68 #endif
69
70
71 //
72 // Wrappers for 64-bit constants
73 //
74
75 #if defined(__GNUC__) || defined(__HP_aCC)
76 #define _LL(x) (x ## LL)
77 #define _ULL(x) (x ## ULL)
78 #else
79 #define _LL(x) (x)
80 #define _ULL(x) (x)
81 #endif
82
83
84 //
85 // Common constants
86 //
87
88 #define MAX_SECRET_LENGTH 64
89 #define MAX_DB_STRING 256
90 #define MAX_PARAM_NAME 256
91 #define GROUP_FLAG ((DWORD)0x80000000)
92
93 #define NETXMS_MAX_CIPHERS 4
94 #define NETXMS_RSA_KEYLEN 2048
95
96 #ifndef LLONG_MAX
97 #define LLONG_MAX _LL(9223372036854775807)
98 #endif
99
100 #ifndef LLONG_MIN
101 #define LLONG_MIN (-LLONG_MAX - 1)
102 #endif
103
104 #ifndef ULLONG_MAX
105 #define ULLONG_MAX _ULL(18446744073709551615)
106 #endif
107
108 #ifndef EVENTLOG_DEBUG_TYPE
109 #define EVENTLOG_DEBUG_TYPE 255
110 #endif
111
112
113 //
114 // Platform dependent includes and defines
115 //
116
117 #if defined(_WIN32) || defined(UNDER_CE)
118
119 /********** WINDOWS ********************/
120
121 #ifndef _WIN32_WINNT
122 #define _WIN32_WINNT 0x0500
123 #endif
124
125 #define FS_PATH_SEPARATOR _T("\\")
126 #define FS_PATH_SEPARATOR_CHAR _T('\\')
127
128 #include <winsock2.h>
129 #include <windows.h>
130 #include <stdlib.h>
131
132 #ifndef UNDER_CE
133 #include <sys/stat.h>
134 #include <process.h>
135 #include <io.h>
136 #include <fcntl.h>
137 #endif
138
139 #ifndef S_IRUSR
140 # define S_IRUSR 0400
141 #endif
142 #ifndef S_IWUSR
143 # define S_IWUSR 0200
144 #endif
145
146 #define snprintf _snprintf
147 #define vsnprintf _vsnprintf
148 #define popen _popen
149 #define pclose _pclose
150 #define strdup _strdup
151 #define stricmp _stricmp
152 #define strnicmp _strnicmp
153 #define open _open
154 #define read _read
155 #define write _write
156 #define close _close
157 #define getpid _getpid
158 #define fileno _fileno
159
160 typedef unsigned __int64 QWORD;
161 typedef __int64 INT64;
162 typedef int socklen_t;
163
164 #define INT64_FMT _T("%I64d")
165 #define UINT64_FMT _T("%I64u")
166 #define UINT64X_FMT(m) _T("%") m _T("I64X")
167 #ifdef __64BIT__
168 #define TIME_T_FMT _T("%I64u")
169 #else
170 #define TIME_T_FMT _T("%u")
171 #endif
172
173 // Socket compatibility
174 #define SHUT_RD 0
175 #define SHUT_WR 1
176 #define SHUT_RDWR 2
177
178 #define SetSocketReuseFlag(sd)
179 #define SELECT_NFDS(x) ((int)(x))
180 #define SetSocketNonBlocking(s) { \
181 u_long one = 1; \
182 ioctlsocket(s, FIONBIO, &one); \
183 }
184
185 #ifdef UNDER_CE
186 #define O_RDONLY 0x0004
187 #define O_WRONLY 0x0001
188 #define O_RDWR 0x0002
189 #define O_CREAT 0x0100
190 #define O_EXCL 0x0200
191 #define O_TRUNC 0x0800
192 #endif
193
194 #if !defined(UNDER_CE)
195 #define HAVE_LIBEXPAT 1
196 #endif
197
198 #elif defined(_NETWARE)
199
200 /********** NETWARE ********************/
201
202 #define FS_PATH_SEPARATOR _T("/")
203 #define FS_PATH_SEPARATOR_CHAR _T('/')
204
205 #include <unistd.h>
206 #include <stdlib.h>
207 #include <sys/types.h>
208 #include <sys/stat.h>
209 #include <sys/socket.h>
210 #include <sys/select.h>
211 #include <netinet/in.h>
212 #include <arpa/inet.h>
213 #include <stdint.h>
214 #include <fcntl.h>
215 #include <errno.h>
216 #include <dirent.h>
217 #include <wchar.h>
218 #include <netdb.h>
219
220 typedef int BOOL;
221 #if (SIZEOF_LONG == 4)
222 typedef long LONG;
223 #else
224 typedef int LONG;
225 #endif
226 #if (SIZEOF_LONG == 4)
227 typedef unsigned long DWORD;
228 #else
229 typedef unsigned int DWORD;
230 #endif
231 typedef unsigned short WORD;
232 typedef unsigned char BYTE;
233 typedef void * HANDLE;
234 typedef void * HMODULE;
235
236 #ifdef X_INT64_X
237 typedef X_INT64_X INT64;
238 #else
239 #error Target system does not have signed 64bit integer type
240 #endif
241
242 #ifdef X_UINT64_X
243 typedef X_UINT64_X QWORD;
244 #else
245 #error Target system does not have unsigned 64bit integer type
246 #endif
247
248 #define INT64_FMT _T("%lld")
249 #define UINT64_FMT _T("%llu")
250 #define UINT64X_FMT(m) _T("%") m _T("llX")
251 #define TIME_T_FMT _T("%u")
252
253 #ifndef MAX_PATH
254 #define MAX_PATH 256
255 #endif
256
257 // Socket compatibility
258 typedef int SOCKET;
259
260 #define closesocket(x) close(x)
261 #define WSAGetLastError() (errno)
262
263 #define WSAEINTR EINTR
264 #define WSAEWOULDBLOCK EWOULDBLOCK
265 #define INVALID_SOCKET (-1)
266
267 #define SetSocketReuseFlag(sd) { \
268 int nVal = 1; \
269 setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (const void *)&nVal, \
270 (socklen_t)sizeof(nVal)); \
271 }
272
273 #define SetSocketNonBlocking(s) { \
274 int f = fcntl(s, F_GETFL); \
275 if (f != -1) fcntl(s, F_SETFL, f | O_NONBLOCK); \
276 }
277
278 #define SELECT_NFDS(x) (x)
279
280 #else /* not _WIN32 and not _NETWARE */
281
282 /*********** UNIX *********************/
283
284 #ifndef PREFIX
285 #define PREFIX "/usr/local"
286 #define PREFIXW L"/usr/local"
287 #warning Installation prefix not defined, defaulting to /usr/local
288 #endif
289
290 #if HAVE_WCHAR_H
291 #include <wchar.h>
292 #endif
293
294 #if HAVE_WCTYPE_H
295 #include <wctype.h>
296 #endif
297
298 #include <errno.h>
299
300 #define FS_PATH_SEPARATOR _T("/")
301 #define FS_PATH_SEPARATOR_CHAR _T('/')
302
303 #if HAVE_UNISTD_H
304 #include <unistd.h>
305 #endif
306
307 #if HAVE_STDLIB_H
308 #include <stdlib.h>
309 #endif
310
311 #if HAVE_SYS_TYPES_H
312 #include <sys/types.h>
313 #endif
314
315 #if HAVE_SYS_INT_TYPES_H
316 #include <sys/int_types.h>
317 #endif
318
319 #if HAVE_SYS_STAT_H
320 #include <sys/stat.h>
321 #endif
322
323 #if HAVE_SYS_SOCKET_H
324 #include <sys/socket.h>
325 #endif
326
327 #if HAVE_SYS_SELECT_H
328 #include <sys/select.h>
329 #endif
330
331 #if HAVE_NETINET_IN_H
332 #include <netinet/in.h>
333 #endif
334
335 #if HAVE_NET_NH_H
336 #include <net/nh.h>
337 #endif
338
339 #if HAVE_ARPA_INET_H
340 #include <arpa/inet.h>
341 #endif
342
343 #if HAVE_NETDB_H
344 #include <netdb.h>
345 #endif
346
347 #if HAVE_FCNTL_H
348 #include <fcntl.h>
349 #endif
350
351 #include <dirent.h>
352
353 #if _USE_GNU_PTH
354 #include <pth.h>
355 #endif
356
357 typedef int BOOL;
358 #if (SIZEOF_LONG == 4)
359 typedef long LONG;
360 typedef unsigned long DWORD;
361 #undef __64BIT__
362 #else
363 typedef int LONG;
364 typedef unsigned int DWORD;
365 #ifndef __64BIT__
366 #define __64BIT__
367 #endif
368 #endif
369 typedef unsigned short WORD;
370 typedef unsigned char BYTE;
371 typedef void * HANDLE;
372 typedef void * HMODULE;
373
374 #if !HAVE_MODE_T
375 typedef int mode_t;
376 #endif
377
378 #if HAVE_INT64_T
379 typedef int64_t INT64;
380 #else
381 #error Target system does not have signed 64bit integer type
382 #endif
383
384 #if HAVE_UINT64_T
385 typedef uint64_t QWORD;
386 #elif HAVE_U_INT64_T
387 typedef u_int64_t QWORD;
388 #else
389 #error Target system does not have unsigned 64bit integer type
390 #endif
391
392 #define INT64_FMT _T("%lld")
393 #define UINT64_FMT _T("%llu")
394 #define UINT64X_FMT(m) _T("%") m _T("llX")
395 #ifdef __64BIT__
396 #define TIME_T_FMT _T("%llu")
397 #else
398 #define TIME_T_FMT _T("%u")
399 #endif
400
401 #ifndef TRUE
402 #define TRUE 1
403 #endif
404 #ifndef FALSE
405 #define FALSE 0
406 #endif
407
408 #ifndef MAX_PATH
409 #define MAX_PATH 256
410 #endif
411
412 // Socket compatibility
413 typedef int SOCKET;
414
415 #define closesocket(x) close(x)
416 #define WSAGetLastError() (errno)
417
418 #define WSAEINTR EINTR
419 #define WSAEWOULDBLOCK EWOULDBLOCK
420 #define INVALID_SOCKET (-1)
421
422 #define SetSocketReuseFlag(sd) { \
423 int nVal = 1; \
424 setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (const void *)&nVal, \
425 (socklen_t)sizeof(nVal)); \
426 }
427
428 #define SetSocketNonBlocking(s) { \
429 int f = fcntl(s, F_GETFL); \
430 if (f != -1) fcntl(s, F_SETFL, f | O_NONBLOCK); \
431 }
432
433 #define SELECT_NFDS(x) (x)
434
435 #if !(HAVE_SOCKLEN_T) && !defined(_USE_GNU_PTH)
436 typedef unsigned int socklen_t;
437 #endif
438
439 // Shared library suffix
440 #ifndef SHL_SUFFIX
441 #if defined(_HPUX) && !defined(__64BIT__)
442 #define SHL_SUFFIX ".sl"
443 #else
444 #define SHL_SUFFIX ".so"
445 #endif
446 #endif
447
448 typedef struct hostent HOSTENT;
449
450 #endif /* _WIN32 */
451
452
453 //
454 // Value used to indicate invalid pointer where NULL is not appropriate
455 //
456
457 #ifdef __64BIT__
458 #define INVALID_POINTER_VALUE ((void *)_ULL(0xFFFFFFFFFFFFFFFF))
459 #else
460 #define INVALID_POINTER_VALUE ((void *)0xFFFFFFFF)
461 #endif
462
463
464 //
465 // Casting between pointer and 32-bit integer
466 //
467
468 #ifdef __64BIT__
469 #define CAST_FROM_POINTER(p, t) ((t)((QWORD)p))
470 #define CAST_TO_POINTER(v, t) ((t)((QWORD)v))
471 #else
472 #define CAST_FROM_POINTER(p, t) ((t)p)
473 #define CAST_TO_POINTER(v, t) ((t)v)
474 #endif
475
476
477 //
478 // OpenSSL
479 //
480
481 #ifdef _WITH_ENCRYPTION
482
483 #include <openssl/crypto.h>
484 #include <openssl/rsa.h>
485 #include <openssl/pem.h>
486 #include <openssl/evp.h>
487 #include <openssl/rand.h>
488 #include <openssl/opensslv.h>
489 #include <openssl/err.h>
490
491 #ifdef NETXMS_NO_AES
492 #ifndef OPENSSL_NO_AES
493 #define OPENSSL_NO_AES
494 #endif
495 #endif
496
497 #ifdef NETXMS_NO_BF
498 #ifndef OPENSSL_NO_BF
499 #define OPENSSL_NO_BF
500 #endif
501 #endif
502
503 #ifdef NETXMS_NO_IDEA
504 #ifndef OPENSSL_NO_IDEA
505 #define OPENSSL_NO_IDEA
506 #endif
507 #endif
508
509 #ifdef NETXMS_NO_DES
510 #ifndef OPENSSL_NO_DES
511 #define OPENSSL_NO_DES
512 #endif
513 #endif
514
515 #if OPENSSL_VERSION_NUMBER >= 0x00907000
516 #define OPENSSL_CONST const
517 #else
518 #define OPENSSL_CONST
519 #endif
520
521 #else
522
523 // Prevent compilation errors on function prototypes
524 #define RSA void
525
526 #endif
527
528
529 //
530 // open() flags compatibility
531 //
532
533 #ifndef O_BINARY
534 #define O_BINARY 0
535 #endif
536
537
538 //
539 // Windows-specific structures for non-Windows platforms
540 //
541
542 #ifndef _WIN32
543
544 typedef struct tagPOINT
545 {
546 int x;
547 int y;
548 } POINT;
549
550 #endif
551
552
553 //
554 // Event log severity codes (UNIX only)
555 //
556
557 #ifndef _WIN32
558 #define EVENTLOG_INFORMATION_TYPE 0
559 #define EVENTLOG_WARNING_TYPE 1
560 #define EVENTLOG_ERROR_TYPE 2
561 #endif /* _WIN32 */
562
563
564 //
565 // Interface types
566 //
567
568 #define IFTYPE_OTHER 1
569 #define IFTYPE_REGULAR1822 2
570 #define IFTYPE_HDH1822 3
571 #define IFTYPE_DDN_X25 4
572 #define IFTYPE_RFC877_X25 5
573 #define IFTYPE_ETHERNET_CSMACD 6
574 #define IFTYPE_ISO88023_CSMACD 7
575 #define IFTYPE_ISO88024_TOKENBUS 8
576 #define IFTYPE_ISO88025_TOKENRING 9
577 #define IFTYPE_ISO88026_MAN 10
578 #define IFTYPE_STARLAN 11
579 #define IFTYPE_PROTEON_10MBIT 12
580 #define IFTYPE_PROTEON_80MBIT 13
581 #define IFTYPE_HYPERCHANNEL 14
582 #define IFTYPE_FDDI 15
583 #define IFTYPE_LAPB 16
584 #define IFTYPE_SDLC 17
585 #define IFTYPE_DS1 18
586 #define IFTYPE_E1 19
587 #define IFTYPE_BASIC_ISDN 20
588 #define IFTYPE_PRIMARY_ISDN 21
589 #define IFTYPE_PROP_PTP_SERIAL 22
590 #define IFTYPE_PPP 23
591 #define IFTYPE_SOFTWARE_LOOPBACK 24
592 #define IFTYPE_EON 25
593 #define IFTYPE_ETHERNET_3MBIT 26
594 #define IFTYPE_NSIP 27
595 #define IFTYPE_SLIP 28
596 #define IFTYPE_ULTRA 29
597 #define IFTYPE_DS3 30
598 #define IFTYPE_SMDS 31
599 #define IFTYPE_FRAME_RELAY 32
600 #define IFTYPE_RS232 33
601 #define IFTYPE_PARA 34
602 #define IFTYPE_ARCNET 35
603 #define IFTYPE_ARCNET_PLUS 36
604 #define IFTYPE_ATM 37
605 #define IFTYPE_MIOX25 38
606 #define IFTYPE_SONET 39
607 #define IFTYPE_X25PLE 40
608 #define IFTYPE_ISO88022LLC 41
609 #define IFTYPE_LOCALTALK 42
610 #define IFTYPE_SMDS_DXI 43
611 #define IFTYPE_FRAME_RELAY_SERVICE 44
612 #define IFTYPE_V35 45
613 #define IFTYPE_HSSI 46
614 #define IFTYPE_HIPPI 47
615 #define IFTYPE_MODEM 48
616 #define IFTYPE_AAL5 49
617 #define IFTYPE_SONET_PATH 50
618 #define IFTYPE_SONET_VT 51
619 #define IFTYPE_SMDS_ICIP 52
620 #define IFTYPE_PROP_VIRTUAL 53
621 #define IFTYPE_PROP_MULTIPLEXOR 54
622 #define IFTYPE_IEEE80212 55
623 #define IFTYPE_FIBRECHANNEL 56
624
625 #define IFTYPE_NETXMS_NAT_ADAPTER 65535
626
627
628 //
629 // IP Header -- RFC 791
630 //
631
632 typedef struct tagIPHDR
633 {
634 BYTE m_cVIHL; // Version and IHL
635 BYTE m_cTOS; // Type Of Service
636 WORD m_wLen; // Total Length
637 WORD m_wId; // Identification
638 WORD m_wFlagOff; // Flags and Fragment Offset
639 BYTE m_cTTL; // Time To Live
640 BYTE m_cProtocol; // Protocol
641 WORD m_wChecksum; // Checksum
642 struct in_addr m_iaSrc; // Internet Address - Source
643 struct in_addr m_iaDst; // Internet Address - Destination
644 } IPHDR;
645
646
647 //
648 // ICMP Header - RFC 792
649 //
650
651 typedef struct tagICMPHDR
652 {
653 BYTE m_cType; // Type
654 BYTE m_cCode; // Code
655 WORD m_wChecksum; // Checksum
656 WORD m_wId; // Identification
657 WORD m_wSeq; // Sequence
658 char m_cData[4]; // Data
659 } ICMPHDR;
660
661
662 //
663 // INADDR_NONE can be undefined on some systems
664 //
665
666 #ifndef INADDR_NONE
667 #define INADDR_NONE (0xFFFFFFFF)
668 #endif
669
670
671 //
672 // Check if IP address is a broadcast
673 //
674
675 #define IsBroadcastAddress(addr, mask) (((addr) & (~(mask))) == (~(mask)))
676
677
678 //
679 // Check if given string is NULL and always return valid pointer
680 //
681
682 #define CHECK_NULL(x) ((x) == NULL ? ((TCHAR *)_T("(null)")) : (x))
683 #define CHECK_NULL_A(x) ((x) == NULL ? ((char *)"(null)") : (x))
684 #define CHECK_NULL_EX(x) ((x) == NULL ? ((TCHAR *)_T("")) : (x))
685
686
687 //
688 // Free memory block if it isn't NULL
689 //
690
691 #define safe_free(x) { if ((x) != NULL) free(x); }
692 #define safe_free_and_null(x) { if ((x) != NULL) { free(x); x = NULL; } }
693
694
695 //
696 // delete object and nullify pointer
697 //
698
699 #define delete_and_null(x) { delete x; x = NULL; }
700 #define safe_delete_and_null(x) { if ((x) != NULL) { delete x; x = NULL; } }
701
702
703 //
704 // Convert half-byte's value to hex digit and vice versa
705 //
706
707 #define bin2hex(x) ((x) < 10 ? ((x) + _T('0')) : ((x) + (_T('A') - 10)))
708 #ifdef UNICODE
709 #define hex2bin(x) ((((x) >= _T('0')) && ((x) <= _T('9'))) ? ((x) - _T('0')) : \
710 (((towupper(x) >= _T('A')) && (towupper(x) <= _T('F'))) ? (towupper(x) - _T('A') + 10) : 0))
711 #else
712 #define hex2bin(x) ((((x) >= '0') && ((x) <= '9')) ? ((x) - '0') : \
713 (((toupper(x) >= 'A') && (toupper(x) <= 'F')) ? (toupper(x) - 'A' + 10) : 0))
714 #endif
715
716
717 //
718 // Define min() and max() if needed
719 //
720
721 #ifndef min
722 #define min(a, b) ((a) < (b) ? (a) : (b))
723 #endif
724 #ifndef max
725 #define max(a, b) ((a) > (b) ? (a) : (b))
726 #endif
727
728
729 //
730 // Define stricmp() for non-windows
731 //
732
733 #ifndef _WIN32
734 #define stricmp strcasecmp
735 #define strnicmp strncasecmp
736 #define wcsicmp wcscasecmp
737 #define wcsnicmp wcsncasecmp
738 #endif
739
740
741 //
742 // Compare two numbers and return -1, 0, or 1
743 //
744
745 #define COMPARE_NUMBERS(n1,n2) (((n1) < (n2)) ? -1 : (((n1) > (n2)) ? 1 : 0))
746
747
748 //
749 // Increment pointer for given number of bytes
750 //
751
752 #define inc_ptr(ptr, step, ptype) ptr = (ptype *)(((char *)ptr) + step)
753
754
755 //
756 // Validate numerical value
757 //
758
759 #define VALIDATE_VALUE(var,x,y,z) { if ((var < x) || (var > y)) var = z; }
760
761
762 //
763 // DCI (data collection item) data types
764 //
765
766 #define DCI_DT_INT 0
767 #define DCI_DT_UINT 1
768 #define DCI_DT_INT64 2
769 #define DCI_DT_UINT64 3
770 #define DCI_DT_STRING 4
771 #define DCI_DT_FLOAT 5
772 #define DCI_DT_NULL 6
773
774
775 //
776 // Insert parameter as string
777 //
778
779 #ifdef UNICODE
780 #define STRING(x) L#x
781 #else
782 #define STRING(x) #x
783 #endif
784
785
786 //
787 // Memory debug
788 //
789
790 #ifdef NETXMS_MEMORY_DEBUG
791
792 #ifdef __cplusplus
793 extern "C" {
794 #endif
795
796 void *nx_malloc(size_t, char *, int);
797 void *nx_realloc(void *, size_t, char *, int);
798 void nx_free(void *, char *, int);
799
800 void InitMemoryDebugger(void);
801 void PrintMemoryBlocks(void);
802
803 #ifdef __cplusplus
804 }
805 #endif
806
807 #define malloc(x) nx_malloc(x, __FILE__, __LINE__)
808 #define realloc(p, x) nx_realloc(p, x, __FILE__, __LINE__)
809 #define free(p) nx_free(p, __FILE__, __LINE__)
810
811 #endif /* NETXMS_MEMORY_DEBUG */
812
813 #endif /* _nms_common_h_ */