00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00020 #ifndef _OOCOMMON_H_
00021 #define _OOCOMMON_H_
00022
00023 #include <limits.h>
00024 #include <stdio.h>
00025 #include <string.h>
00026 #include <stdlib.h>
00027
00028 #ifdef _WIN32_WCE
00029 #include <winsock.h>
00030 #elif defined(_WIN32) || defined(_WIN64)
00031 #include <sys/types.h>
00032 #define INCL_WINSOCK_API_TYPEDEFS 1
00033 #define INCL_WINSOCK_API_PROTOTYPES 0
00034 #include <winsock2.h>
00035 #else
00036 #include <sys/types.h>
00037 #include <sys/time.h>
00038 #include <sys/socket.h>
00039 #include <netinet/in.h>
00040 #include <netdb.h>
00041 #include <unistd.h>
00042 #include <arpa/inet.h>
00043 #endif
00044
00050
00051
00052 typedef char OOCHAR;
00053 typedef unsigned char OOUCHAR;
00054 typedef signed char OOINT8;
00055 typedef unsigned char OOUINT8;
00056 typedef short OOINT16;
00057 typedef unsigned short OOUINT16;
00058 typedef int OOINT32;
00059 typedef unsigned int OOUINT32;
00060 typedef OOUINT8 OOBOOL;
00061
00062 #define OOUINT32_MAX 4294967295U
00063 #define OOINT32_MAX ((OOINT32)2147483647L)
00064 #define OOINT32_MIN ((OOINT32)(-OOINT32_MAX-1))
00065
00066 #ifndef FALSE
00067 #define FALSE 0
00068 #define TRUE 1
00069 #endif
00070
00071
00072
00073 #define OOERRINVPARAM (-50)
00074 #define OOERRBUFOVFLW (-51)
00075 #define OOERRNOMEM (-52)
00076
00077
00078
00079 typedef struct _OOMsgBuf {
00080 OOUINT8* pdata;
00081 OOUINT32 bufsiz;
00082 OOUINT32 length;
00083 OOUINT32 offset;
00084 OOBOOL dynamic;
00085 } OOMsgBuf;
00086
00087
00088
00089 typedef struct OOEnumItem {
00090 const char* name;
00091 OOINT32 value;
00092 OOUINT16 namelen;
00093 OOUINT16 transidx;
00094 } OOEnumItem;
00095
00096
00097
00098
00099
00100 #define OOMEMALLOC malloc
00101 #define OOMEMFREE free
00102
00103
00104
00105 #ifndef OOMAX
00106 #define OOMAX(a,b) (((a)>(b))?(a):(b))
00107 #endif
00108
00109 #ifndef OOMIN
00110 #define OOMIN(a,b) (((a)<(b))?(a):(b))
00111 #endif
00112
00113
00114
00115 #define OONUMBEROF(items) (sizeof(items)/sizeof(items[0]))
00116
00117
00118
00119
00120 #ifndef EXTERN
00121 #if defined (MAKE_DLL)
00122 #define EXTERN __declspec(dllexport)
00123 #elif defined (USE_DLL)
00124 #define EXTERN __declspec(dllimport)
00125 #else
00126 #define EXTERN
00127 #endif
00128 #endif
00129
00130 EXTERN OOINT32 lookupEnum
00131 (const char* strValue, size_t strValueSize, const OOEnumItem enumTable[],
00132 OOUINT16 enumTableSize);
00133
00134 #if defined(_WIN32) || defined(_WIN64)
00135 #define strcasecmp _stricmp
00136 #endif
00137
00141 #endif