Mixe for Privacy and Anonymity in the Internet
basetypedefs.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000, The JAP-Team 
00003 All rights reserved.
00004 Redistribution and use in source and binary forms, with or without modification, 
00005 are permitted provided that the following conditions are met:
00006 
00007   - Redistributions of source code must retain the above copyright notice, 
00008     this list of conditions and the following disclaimer.
00009 
00010   - Redistributions in binary form must reproduce the above copyright notice, 
00011     this list of conditions and the following disclaimer in the documentation and/or 
00012     other materials provided with the distribution.
00013 
00014   - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors 
00015     may be used to endorse or promote products derived from this software without specific 
00016     prior written permission. 
00017 
00018   
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027 */
00028 
00029 #ifndef __BASE_TYPE_DEFS
00030 #define __BASE_TYPE_DEFS
00031 
00032 #ifdef _WIN32
00033   #define HAVE_NATIVE_UINT64
00034     //UINT64 already defined by Windows!
00035     typedef _int64 SINT64;
00036     typedef signed long SINT32;
00037     typedef unsigned short UINT16;
00038     typedef signed short SINT16;
00039     typedef unsigned char UINT8;
00040     typedef signed char SINT8;
00041 #else
00042   #ifdef HAVE_CONFIG_H
00043       #if SIZEOF_UNSIGNED_CHAR == 1 && !defined HAVE_UINT8
00044         #define HAVE_UINT8
00045         typedef unsigned char UINT8;
00046       #endif
00047       #if SIZEOF_SIGNED_CHAR == 1 && !defined HAVE_SINT8
00048         #define HAVE_SINT8
00049         typedef signed char SINT8;
00050       #endif
00051       #if SIZEOF_UNSIGNED_SHORT == 2 && !defined HAVE_UINT16
00052         #define HAVE_UINT16
00053         typedef unsigned short UINT16;
00054       #endif
00055       #if SIZEOF_SIGNED_SHORT == 2 && !defined HAVE_SINT16
00056         #define HAVE_SINT16
00057         typedef unsigned short SINT16;
00058       #endif
00059         #if SIZEOF_UNSIGNED_INT == 4 && !defined HAVE_UINT32
00060         #define HAVE_UINT32
00061         typedef unsigned int UINT32;
00062       #endif
00063       #if SIZEOF_SIGNED_INT == 4 && !defined HAVE_SINT32
00064         #define HAVE_SINT32
00065         typedef signed int SINT32;
00066       #endif
00067       #if SIZEOF___UINT64_T == 8 && !defined HAVE_UINT64
00068         #define HAVE_UINT64
00069         typedef unsigned long long UINT64;
00070         typedef signed long long SINT64;
00071       #endif
00072       #if SIZEOF_UNSIGNED_LONG_LONG == 8 && !defined HAVE_UINT64
00073         #define HAVE_UINT64
00074         typedef unsigned long long UINT64;
00075         typedef signed long long SINT64;
00076       #endif
00077       #ifdef HAVE_UINT64
00078               #define HAVE_NATIVE_UINT64
00079       #endif
00080   #else
00081     #if defined(__linux)
00082       #include <linux/types.h>
00083       #define HAVE_NATIVE_UINT64
00084       typedef unsigned long long UINT64;
00085       typedef signed long long SINT64;
00086       typedef __u32 UINT32;
00087       typedef __s32 SINT32;
00088       typedef __u16 UINT16;
00089       typedef __s16 SINT16;
00090       typedef __u8 UINT8;
00091       typedef __s8 SINT8;
00092     #elif defined(__sgi)
00093       #define HAVE_NATIVE_UINT64
00094       typedef __uint64_t UINT64;  
00095       typedef __int64_t SINT64; 
00096       typedef __uint32_t UINT32;
00097       typedef __int32_t SINT32;
00098       typedef unsigned short UINT16;
00099       typedef signed short SINT16;
00100       typedef unsigned char UINT8;
00101       typedef signed char SINT8;
00102     #elif defined(__sun)      
00103       typedef uint32_t UINT32;
00104       typedef int32_t SINT32;
00105       typedef uint16_t UINT16;
00106       typedef int16_t SINT16;
00107       typedef uint8_t UINT8;
00108       typedef int8_t SINT8;
00109     #elif defined __APPLE_CC__  
00110       #define HAVE_NATIVE_UINT64
00111       typedef unsigned long long UINT64;
00112       typedef signed long long SINT64;
00113       typedef unsigned int UINT32;
00114       typedef signed int SINT32;
00115       typedef unsigned short UINT16;
00116       typedef signed short SINT16;
00117       typedef unsigned char UINT8;
00118       typedef signed char SINT8;
00119     #else       
00120       #warning This seams to be a currently not supported plattform - may be things go wrong! 
00121       #warning Please report the plattform, so that it could be added 
00122       #ifdef __GNUC__ //TODO check if for all GNUC long long is 64 bit!!
00123         #define HAVE_NATIVE_UINT64
00124         typedef unsigned long long UINT64;
00125         typedef signed long long SINT64;
00126       #endif
00127       typedef unsigned int UINT32;
00128       typedef signed int SINT32;
00129       typedef unsigned short UINT16;
00130       typedef signed short SINT16;
00131       typedef unsigned char UINT8;
00132       typedef signed char SINT8;
00133     #endif
00134   #endif //HAVE_CONFIG_H?
00135 #endif //WIN32?
00136 
00137 #if !defined(HAVE_NATIVE_UINT64)
00138   typedef struct __UINT64__t_
00139     {
00140       UINT32 high;
00141       UINT32 low;
00142     } UINT64;  
00143 
00144   typedef struct __SINT64__t_
00145     {
00146       SINT32 high;
00147       UINT32 low;
00148     } SINT64;  
00149 #endif
00150 
00151 typedef unsigned int UINT;
00152 typedef signed int SINT;
00153   
00154 #endif//__BASE_TYPES_DEFS_H