| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef _OOCOMMON_H_ |
| 21 |
#define _OOCOMMON_H_ |
| 22 |
|
| 23 |
#include <limits.h> |
| 24 |
#include <stdio.h> |
| 25 |
#include <string.h> |
| 26 |
#include <stdlib.h> |
| 27 |
|
| 28 |
#ifdef _WIN32_WCE |
| 29 |
#include <winsock.h> |
| 30 |
#elif defined(_WIN32) || defined(_WIN64) |
| 31 |
#include <sys/types.h> |
| 32 |
#define INCL_WINSOCK_API_TYPEDEFS 1 |
| 33 |
#define INCL_WINSOCK_API_PROTOTYPES 0 |
| 34 |
#include <winsock2.h> |
| 35 |
#else |
| 36 |
#include <sys/types.h> |
| 37 |
#include <sys/time.h> |
| 38 |
#include <sys/socket.h> |
| 39 |
#include <netinet/in.h> |
| 40 |
#include <netdb.h> |
| 41 |
#include <unistd.h> |
| 42 |
#include <arpa/inet.h> |
| 43 |
#endif |
| 44 |
#include <semaphore.h> |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
typedef char OOCHAR; |
| 54 |
typedef unsigned char OOUCHAR; |
| 55 |
typedef signed char OOINT8; |
| 56 |
typedef unsigned char OOUINT8; |
| 57 |
typedef short OOINT16; |
| 58 |
typedef unsigned short OOUINT16; |
| 59 |
typedef int OOINT32; |
| 60 |
typedef unsigned int OOUINT32; |
| 61 |
typedef OOUINT8 OOBOOL; |
| 62 |
|
| 63 |
#define OOUINT32_MAX 4294967295U |
| 64 |
#define OOINT32_MAX ((OOINT32)2147483647L) |
| 65 |
#define OOINT32_MIN ((OOINT32)(-OOINT32_MAX-1)) |
| 66 |
|
| 67 |
#ifndef FALSE |
| 68 |
#define FALSE 0 |
| 69 |
#define TRUE 1 |
| 70 |
#endif |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
#define OOERRINVPARAM (-50) |
| 75 |
#define OOERRBUFOVFLW (-51) |
| 76 |
#define OOERRNOMEM (-52) |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
typedef struct _OOMsgBuf { |
| 81 |
OOUINT8* pdata; |
| 82 |
OOUINT32 bufsiz; |
| 83 |
OOUINT32 length; |
| 84 |
OOUINT32 offset; |
| 85 |
OOBOOL dynamic; |
| 86 |
} OOMsgBuf; |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
#define OOMEMALLOC malloc |
| 93 |
#define OOMEMFREE free |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
#ifndef OOMAX |
| 98 |
#define OOMAX(a,b) (((a)>(b))?(a):(b)) |
| 99 |
#endif |
| 100 |
|
| 101 |
#ifndef OOMIN |
| 102 |
#define OOMIN(a,b) (((a)<(b))?(a):(b)) |
| 103 |
#endif |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
#define OONUMBEROF(items) (sizeof(items)/sizeof(items[0])) |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
#ifndef EXTERN |
| 113 |
#if defined (MAKE_DLL) |
| 114 |
#define EXTERN __declspec(dllexport) |
| 115 |
#elif defined (USE_DLL) |
| 116 |
#define EXTERN __declspec(dllimport) |
| 117 |
#else |
| 118 |
#define EXTERN |
| 119 |
#endif |
| 120 |
#endif |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
#endif |