Integer type name change.
[silc.git] / includes / silcincludes.h
1 /*
2
3   silcincludes.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 1997 - 2001 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20 /*
21   This file includes common definitions for SILC. This file MUST be included
22   by all files in SILC (directly or through other global include file).
23 */
24
25 #ifndef SILCINCLUDES_H
26 #define SILCINCLUDES_H
27
28 /* Automatically generated configuration header */
29 #include "silcdefs.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #ifdef WIN32
36 #ifndef SILC_WIN32
37 #define SILC_WIN32
38 #endif
39 #endif
40
41 #if defined(__EPOC32__)
42 #ifndef SILC_EPOC
43 #define SILC_EPOC
44 #endif
45 #endif
46
47 #ifdef BEOS
48 #ifndef SILC_BEOS
49 #define SILC_BEOS
50 #endif
51 #elif defined(__BEOS__)
52 #ifndef SILC_BEOS
53 #define SILC_BEOS
54 #endif
55 #endif
56
57 #if defined(OS2)
58 #ifndef SILC_OS2
59 #define SILC_OS2
60 #endif
61 #endif
62
63 /* Platform specific includes */
64
65 #ifdef SILC_WIN32
66 #include "silcwin32.h"
67 #endif
68
69 #ifdef SILC_EPOC
70 #include "silcepoc.h"
71 #endif
72
73 #ifdef SILC_BEOS
74 #include "silcbeos.h"
75 #endif
76
77 #ifdef SILC_OS2
78 #include "silcos2.h"
79 #endif
80
81 #ifndef DLLAPI
82 #define DLLAPI
83 #endif
84
85 #include <stdio.h>
86 #include <stdlib.h>
87 #include <string.h>
88 #include <stdarg.h>
89 #include <ctype.h>
90 #include <sys/types.h>
91 #include <sys/stat.h>
92 #include <time.h>
93
94 #ifdef HAVE_SIGNAL_H
95 #include <signal.h>
96 #else
97 #error signal.h not found in the system
98 #endif
99
100 #ifdef HAVE_FCNTL_H
101 #include <fcntl.h>
102 #else
103 #error fcntl.h not found in the system
104 #endif
105
106 #ifdef HAVE_ERRNO_H
107 #include <errno.h>
108 #else
109 #error errno.h not found in the system
110 #endif
111
112 #ifdef HAVE_ASSERT_H
113 #include <assert.h>
114 #else
115 #error assert.h not found in the system
116 #endif
117
118 #ifndef SILC_WIN32
119
120 #include <unistd.h>
121 #include <sys/time.h>
122 #include <pwd.h>
123 #include <grp.h>
124 #include <sys/times.h>
125
126 #ifdef HAVE_GETOPT_H
127 #include <getopt.h>
128 #endif
129
130 #ifdef SOCKS5
131 #include "socks.h"
132 #endif
133
134 #include <sys/socket.h>
135 #ifdef HAVE_NETINET_IN_H
136 #include <netinet/in.h>
137 #else
138 #error netinet/in.h not found in the system
139 #endif
140
141 #ifdef HAVE_XTI_H
142 #include <xti.h>
143 #else
144 #ifdef HAVE_NETINET_TCP_H
145 #include <netinet/tcp.h>
146 #else
147 #error xti.h nor even netinet/tcp.h found in the system
148 #endif
149 #endif
150
151 #ifdef HAVE_NETDB_H
152 #include <netdb.h>
153 #else
154 #error netdb.h not found in the system
155 #endif
156
157 #ifdef HAVE_ARPA_INET_H
158 #include <arpa/inet.h>
159 #else
160 #error arpa/inet.h not found in the system
161 #endif
162
163 #ifdef HAVE_SYS_MMAN_H
164 #include <sys/mman.h>
165 #endif
166
167 #ifdef HAVE_DLFCN_H
168 #include <dlfcn.h>
169 #endif
170
171 #ifdef HAVE_LIMITS_H
172 #include <limits.h>
173 #endif
174
175 #ifndef HAVE_REGEX_H
176 #include "../lib/contrib/regex.h"
177 #else
178 #include <regex.h>
179 #endif
180
181 #ifdef SILC_HAVE_PTHREAD
182 #include <pthread.h>
183 #endif
184
185 #ifdef HAVE_STDDEF_H
186 #include <stddef.h>
187 #endif
188
189 #endif                          /* !SILC_WIN32 */
190
191 #ifndef HAVE_GETOPT_LONG
192 #include "../lib/contrib/getopt.h"
193 #endif
194
195 #ifndef TRUE
196 #define TRUE 1
197 #endif
198 #ifndef FALSE
199 #define FALSE 0
200 #endif
201
202 /* Define offsetof */
203 #ifndef offsetof
204 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
205 #endif
206
207 /* Define types. The types must be at least of the specified size */
208
209 typedef unsigned char SilcUInt8;
210 typedef signed char SilcInt8;
211
212 #if SILC_SIZEOF_SHORT > 2
213 #error "size of the short must be 2 bytes"
214 #endif
215
216 typedef unsigned short SilcUInt16;
217 typedef signed short SilcInt16;
218
219 #if SILC_SIZEOF_LONG == 4
220 typedef unsigned long SilcUInt32;
221 typedef signed long SilcInt32;
222 #else
223 #if SILC_SIZEOF_INT == 4
224 typedef unsigned int SilcUInt32;
225 typedef signed int SilcInt32;
226 #else
227 #if SILC_SIZEOF_LONG_LONG >= 4
228 #ifndef WIN32
229 typedef unsigned long long SilcUInt32;
230 typedef signed long long SilcInt32;
231 #endif
232 #endif
233 #endif
234 #endif
235
236 #if SILC_SIZEOF_LONG >= 8
237 typedef unsigned long SilcUInt64;
238 typedef signed long SilcInt64;
239 #else
240 #if SILC_SIZEOF_LONG_LONG >= 8
241 #ifndef WIN32
242 typedef unsigned long long SilcUInt64;
243 typedef signed long long SilcInt64;
244 #else
245 typedef SilcUInt32 SilcUInt64; /* XXX Use Windows's own 64 bit types */
246 typedef SilcInt32 SilcInt64;
247 #endif
248 #else
249 typedef SilcUInt32 SilcUInt64;
250 typedef SilcInt32 SilcInt64;
251 #endif
252 #endif
253
254 #if SILC_SIZEOF_VOID_P < 4
255 typedef SilcUInt32 * void *;
256 #endif
257
258 #ifndef __cplusplus
259 #ifndef bool
260 #define bool unsigned char
261 #endif
262 #endif
263
264 /* Generic global SILC includes */
265 #include "bitmove.h"
266
267 /* Math library includes */
268 #include "silcmp.h"
269 #include "silcmath.h"
270
271 /* Crypto library includes */
272 #include "silccipher.h"
273 #include "silchash.h"
274 #include "silchmac.h"
275 #include "silcrng.h"
276 #include "silcpkcs.h"
277
278 /* SILC util library includes */
279 #include "silcmutex.h"
280 #include "silcthread.h"
281 #include "silcschedule.h"
282 #include "silchashtable.h"
283 #include "silclog.h"
284 #include "silcmemory.h"
285 #include "silclist.h"
286 #include "silcdlist.h"
287 #include "silcbuffer.h"
288 #include "silcbuffmt.h"
289 #include "silcnet.h"
290 #include "silcfileutil.h"
291 #include "silcutil.h"
292 #include "silcconfig.h"
293 #include "silcprotocol.h"
294 #include "silcsockconn.h"
295
296 /* SILC core library includes */
297 #include "silcid.h"
298 #include "silcidcache.h"
299 #include "silcargument.h"
300 #include "silccommand.h"
301 #include "silcchannel.h"
302 #include "silcpacket.h"
303 #include "silcnotify.h"
304 #include "silcmode.h"
305 #include "silcauth.h"
306 #include "silcprivate.h"
307
308 #ifdef SILC_SIM
309 /* SILC Module library includes */
310 #include "silcsim.h"
311 #include "silcsimutil.h"
312 #endif
313
314 /* SILC Key Exchange library includes */
315 #include "silcske.h"
316 #include "silcske_payload.h"
317 #include "silcske_groups.h"
318
319 /* SILC SFTP library */
320 #include "silcsftp.h"
321 #include "silcsftp_fs.h"
322
323 #ifdef __cplusplus
324 }
325 #endif
326
327 #endif /* SILCINCLUDES_H */