Debian Codegraph @

addons/ooh323c/src/ooCommon.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2004-2005 by Objective Systems, Inc.
3 *
4 * This software is furnished under an open source license and may be
5 * used and copied only in accordance with the terms of this license.
6 * The text of the license may generally be found in the root
7 * directory of this installation in the LICENSE.txt file. It
8 * can also be viewed online at the following URL:
9 *
10 * http://www.obj-sys.com/open/license.html
11 *
12 * Any redistributions of this file including modified versions must
13 * maintain this copyright notice.
14 *
15 *****************************************************************************/
16 /**
17 * @file ooCommon.h
18 * Common runtime constant and type definitions.
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 * @ingroup cruntime C Runtime Common Constant and Type Definitions.
48 * @{
49 */
50
51 /* Basic type definitions */
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 /* Common error codes */
73
74 #define OOERRINVPARAM (-50) /* Invalid parameter */
75 #define OOERRBUFOVFLW (-51) /* Buffer overflow */
76 #define OOERRNOMEM (-52) /* No dynamic memory available */
77
78 /* Message buffer: this is used for asynchronous transfers */
79
80 typedef struct _OOMsgBuf {
81 OOUINT8* pdata; /* Pointer to binary or text data */
82 OOUINT32 bufsiz; /* Size of the buffer in bytes */
83 OOUINT32 length; /* # bytes to send (write) or # received (read) */
84 OOUINT32 offset; /* Offset into buffer of first byte to send */
85 OOBOOL dynamic; /* pdata is dynamic (allocated with OOMEMALLOC) */
86 } OOMsgBuf;
87
88 /* Memory allocation and free function definitions. These definitions */
89 /* can be changed if a non-standard allocation/free function is to be */
90 /* used.. */
91
92 #define OOMEMALLOC malloc
93 #define OOMEMFREE free
94
95 /* Min/max macros */
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 /* Get count of number of items in an array */
106
107 #define OONUMBEROF(items) (sizeof(items)/sizeof(items[0]))
108
109 /* This is used for creating a Windows DLL. Specify -DMAKE_DLL to */
110 /* compile code for inclusion in a DLL. */
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 /* _DLL */
120 #endif /* EXTERN */
121
122 /**
123 * @}
124 */
125 #endif /* _OOCOMMON_H_ */