|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2005 Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef __INET_HEADERS_DEFS_H 00019 #define __INET_HEADERS_DEFS_H 00020 00021 // 00022 // Get integer types defined 00023 // 00024 #if defined(_MSC_VER) 00025 typedef __int8 int8_t; 00026 typedef __int16 int16_t; 00027 typedef __int32 int32_t; 00028 typedef __int64 int64_t; 00029 typedef unsigned __int8 uint8_t; 00030 typedef unsigned __int16 uint16_t; 00031 typedef unsigned __int32 uint32_t; 00032 typedef unsigned __int64 uint64_t; 00033 #else 00034 #include <stdint.h> /* ISO C compliant platforms: Linux, Mac OS/X */ 00035 #endif 00036 00037 /* if nothing else helps: 00038 typedef signed char int8_t; 00039 typedef short int16_t; 00040 typedef int int32_t; 00041 typedef long long int64_t; 00042 typedef unsigned char uint8_t; 00043 typedef unsigned short uint16_t; 00044 typedef unsigned int uint32_t; 00045 typedef unsigned long long uint64_t; 00046 */ 00047 00048 // 00049 // Get endianness macros defined 00050 // 00051 #if defined(_WIN32) /*MSVC and MinGW*/ 00052 # define LITTLE_ENDIAN 1 00053 # define BIG_ENDIAN 2 00054 # define BYTE_ORDER LITTLE_ENDIAN /* XXX at least on x86 */ 00055 #elif defined(linux) 00056 # include <endian.h> 00057 # define LITTLE_ENDIAN __LITTLE_ENDIAN 00058 # define BIG_ENDIAN __BIG_ENDIAN 00059 # define BYTE_ORDER __BYTE_ORDER 00060 #elif defined(__APPLE__) 00061 #include <machine/endian.h> 00062 #else /* fallback, including cases __FreeBSD__, __NetBSD__ and __OpenBSD__ */ 00063 //XXX this causes problems in FreeBSD, and probably not needed anyway: #define __BSD_VISIBLE 00064 #include <machine/endian.h> 00065 #endif 00066 00067 #if !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN) || !defined(BYTE_ORDER) || (BYTE_ORDER!=LITTLE_ENDIAN && BYTE_ORDER!=BIG_ENDIAN) 00068 #error Endian macros (LITTLE_ENDIAN, BIG_ENDIAN, BYTE_ORDER) are not set up correctly -- please fix this header file and report it. 00069 #endif 00070 00071 #endif 00072 00073