platform.h
资源名称:h323.zip [点击查看]
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:8k
源码类别:
IP电话/视频会议
开发平台:
WINDOWS
- /*
- * $Revision: 1.13 $
- * $Date: 1998/05/21 19:23:20 $
- */
- ////////////////////////////////////////////////////////////////
- // Copyright (c) 1996,97 Lucent Technologies //
- // All Rights Reserved //
- // //
- // THIS IS UNPUBLISHED //
- // PROPRIETARY SOURCE //
- // CODE OF Lucent Technologies //
- // AND elemedia //
- // //
- // The copyright notice above does not evidence any //
- // actual or intended publication of such source code//
- ////////////////////////////////////////////////////////////////
- //
- ////////////////////////////////////////////////////////////////
- // File : platform.h //
- // //
- // History: //
- // 13_Nov_1996 Created //
- // 28_May_1997 Changes for posix. //
- // 30_Jun_1997 Moved platform specific stuff from cw/types.h //
- // 09_Jul_1997 Changed check for sys/endian.h //
- // 09_Jul_1997 Check for UW and inclusion of sys/byteorder.h //
- // check for __USLC__for changes //
- // 16_Jul_1997 Misaligned access macros.. //
- // 21_Aug_1997 VXworks port //
- // 26_Aug_1997 Removed typedef for wchar_t under WIN32 //
- // 02_Oct_1997 Added process.h for win32 platform. //
- // 01_Dec_1997 Include poll.h if required. //
- // 30_Jan_1998 Include winsock2.h if required. //
- // 23_Mar_1998 Changes for hpux //
- // 21_May_1998 Check for NTOHL and NTOHS before attempting //
- // to define them. The latest version(??) of //
- // VxWorks header files seems to define them. //
- // //
- ////////////////////////////////////////////////////////////////
- #if !defined(__PLATFORM_H__)
- #define __PLATFORM_H__
- #if (defined(__USLC__) && defined(unix)) // unixware 2.x
- #define __SVR4
- #define __UNIX_THREADS__
- #endif
- #if (defined(WIN32))
- #if defined(USE_WINSOCK2)
- #include <winsock2.h>
- #else
- #include <winsock.h>
- #endif
- #include <windows.h>
- #include <process.h>
- #elif (defined(VXWORKS))
- #include "vxWorks.h"
- #include "fcntl.h"
- #include "time.h"
- #include "string.h"
- #include "ctype.h"
- #include "ioLib.h"
- #include "taskLib.h"
- #include "semLib.h"
- #include "selectLib.h"
- #include "sockLib.h"
- #include "inetLib.h"
- #elif (defined(__SVR4))
- #include <unistd.h>
- #if (defined(_POSIX_THREADS))
- #include <pthread.h>
- #elif (defined(__UNIX_THREADS__))
- #include <thread.h>
- #include <synch.h>
- #endif
- #if defined(USE_POLL)
- #include <stropts.h>
- #include <poll.h>
- #endif
- #if (defined(__USLC__))
- #if (defined(DEBUG))
- #undef DEBUG // comes from ossasn1 headers,clash :netinet/in_systm_f.h
- #endif
- #endif
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/filio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <errno.h>
- #include <sys/socket.h>
- #include <sys/select.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <netinet/in_systm.h>
- #include <netinet/ip.h>
- #include <netinet/tcp.h>
- #elif (defined(__hpux))
- #include <unistd.h>
- /* Always use POSIX_THREADS. The #define is inside the .h */
- #include <pthread.h>
- #if defined(USE_POLL)
- #include <stropts.h>
- #include <poll.h>
- #endif
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <stdlib.h>
- #include <string.h>
- #include <errno.h>
- #include <sys/socket.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <netinet/in_systm.h>
- #include <netinet/ip.h>
- #include <netinet/tcp.h>
- #else
- #error unknown OS
- #endif
- #if defined(IRIX) // Check if sys/endian.h exists.
- #include <sys/endian.h>
- #elif defined(__USLC__) // UW has byteorder.h
- #include <sys/byteorder.h>
- #elif defined(VXWORKS)
- #define LITTE_ENDIAN 0x1234
- #define BIG_ENDIAN 0x4321
- #define PDP_ENDIAN 0x3412
- #if (CPU == SIMSPARCSOLARIS)
- #define BYTE_ORDER BIG_ENDIAN
- #elif (CPU == SPARC)
- #define BYTE_ORDER BIG_ENDIAN
- #elif (CPU == R4000)
- #if (CPU_VAR == R4700)
- #ifdef MIPSEB
- #define BYTE_ORDER BIG_ENDIAN
- #else
- #define BYTE_ORDER LITTLE_ENDIAN
- #endif
- #else
- #error Unknown MIPS CPU Variant
- #endif /* CPU_VAR == ?? */
- #elif (CPU == MC68040)
- #define BYTE_ORDER BIG_ENDIAN
- #elif (CPU == I80386)
- #define BYTE_ORDER LITTLE_ENDIAN
- #else
- #error "Unknown CPU type..."
- #endif
- #else
- #define LITTE_ENDIAN 0x1234
- #define BIG_ENDIAN 0x4321
- #define PDP_ENDIAN 0x3412
- #if defined(sparc)
- #define BYTE_ORDER BIG_ENDIAN
- #elif defined(__hpux)
- // There is no CPU variable for hpux. All processors are big endian currently.
- #define BYTE_ORDER BIG_ENDIAN
- #else // BUGALERT!! every thing else is assumed little endian
- #define BYTE_ORDER LITTLE_ENDIAN
- #endif
- #endif // IRIX
- #if (BYTE_ORDER == LITTLE_ENDIAN)
- #if !defined(NTOHL)
- #define NTOHL(L)
- (((unsigned long)(L) << 24) | (((unsigned long)(L) & 0xff00) << 8) |
- (((unsigned long)(L) >> 8) & 0xff00) | ((unsigned long)(L) >> 24))
- #endif
- #if !defined(NTOHS)
- #define NTOHS(S)
- (unsigned short)(((unsigned short)(S) << 8) |
- ((unsigned short)(S) >> 8))
- #endif
- #elif (BYTE_ORDER == BIG_ENDIAN)
- #if !defined(NTOHL)
- #define NTOHL(L) (L)
- #endif
- #if !defined(NTOHS)
- #define NTOHS(S) (S)
- #endif
- #else // PDP
- #error "What!!, are you kidding..."
- #endif // BYTE_ORDER
- #if !defined(HTONS)
- #define HTONS(S) NTOHS(S)
- #endif
- #if !defined(HTONL)
- #define HTONL(L) NTOHL(L)
- #endif
- //
- // BEGIN.. OS Specific section.
- //
- //
- // WIN32 specific defines...
- //
- #if defined(WIN32)
- #define DLLEXPORT __declspec(dllexport)
- #define DLLIMPORT __declspec(dllimport)
- #define Boolean BOOL
- #define srand48 srand
- typedef WCHAR wchar_t;
- // Generate a random number between 0.0 and 1.0
- #define drand48() ((double)rand()/double(RAND_MAX))
- // Disable compilation warnings...
- #if (!defined(NO_WARNING_SUPPRESSION))
- // disable reporting of long variable names warnings..
- #pragma warning( disable : 4786)
- //conversion type' conversion exists from 'type1' to 'type2', but is inaccessible
- //#pragma warning( disable : 4243)
- // 'this' : used in base member initializer list
- #pragma warning( disable : 4355)
- // deletion of pointer to incomplete type
- #pragma warning( disable : 4150)
- #endif // NO_WARNING_SUPPRESSION
- #endif // WIN32
- //
- // SVR4 specific defines..
- //
- #if (defined(__SVR4))
- #define DLLEXPORT
- #define DLLIMPORT
- #define stricmp strcasecmp
- typedef int Boolean; // matches rw - done this way to avoid
- // everyone compiling rw/string.h
- #if (defined(__sun))
- typedef int boolean;
- #endif
- #if (defined(__USLC__))
- extern "C" int strcasecmp(char *, char *);
- #endif
- #if (defined(__USLC__)) // Unixware has its own enum
- #if defined(TRUE)
- #undef TRUE
- #endif
- #if defined(FALSE)
- #undef FALSE
- #endif
- #define TRUE B_TRUE
- #define FALSE B_FALSE
- #else
- #if !defined(TRUE) || ((TRUE) != 1)
- #define TRUE (1)
- #endif
- #if !defined(FALSE) || ((FALSE) != 0)
- #define FALSE (0)
- #endif
- #endif // USLC
- #endif // defined(__SVR4))
- //
- // __hpux specific defines..
- //
- #if (defined(__hpux))
- #define DLLEXPORT
- #define DLLIMPORT
- #define stricmp strcasecmp
- typedef int Boolean; // matches rw - done this way to avoid
- // everyone compiling rw/string.h
- typedef int boolean;
- #if !defined(TRUE) || ((TRUE) != 1)
- #define TRUE (1)
- #endif
- #if !defined(FALSE) || ((FALSE) != 0)
- #define FALSE (0)
- #endif
- #endif // defined(__hpux))
- #if (defined(VXWORKS))
- extern "C" int strcasecmp(char *, char *);
- #define drand48() ((double)rand()/double(RAND_MAX))
- #define srand48 srand
- #if ((CPU == SIMSPARCSOLARIS))
- #else
- #define DLLEXPORT
- #define DLLIMPORT
- #define stricmp strcasecmp
- typedef int Boolean; // matches rw - done this way to avoid
- typedef int boolean;
- #if !defined(TRUE) || ((TRUE) != 1)
- #define TRUE (1)
- #endif
- #if !defined(FALSE) || ((FALSE) != 0)
- #define FALSE (0)
- #endif
- #endif /* CPU == SIMSPARCSOLARIS */
- #endif /* VXWORKS */
- //
- // END.. OS Specific section.
- //
- //
- // BEGIN Architecture specific section
- //
- #if (defined(sparc) && defined (__SVR4)) // solaris2.x on sparc...
- #define ENABLE_MISALIGNED_ACCESS() asm ("ta 6")
- #endif
- #if (defined(VXWORKS)) // vxworks on various targets.
- #if ((CPU == SIMSPARCSOLARIS) || (CPU == SPARC))
- #define ENABLE_MISALIGNED_ACCESS() asm ("ta 6")
- #endif
- #endif
- //
- // END Architecture specific section
- //
- #endif