65bd6a07a40a013b07088de7fcc8bfb514478009
[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 #undef uint8
209 #undef uint16
210 #undef uint32
211 #undef uin64
212 #undef int8
213 #undef int16
214 #undef int32
215 #undef int64
216
217 typedef unsigned char uint8;
218 typedef signed char int8;
219
220 #if SILC_SIZEOF_SHORT > 2
221 #error "size of the short must be 2 bytes"
222 #endif
223
224 typedef unsigned short uint16;
225 typedef signed short int16;
226
227 #if SILC_SIZEOF_LONG == 4
228 typedef unsigned long uint32;
229 typedef signed long int32;
230 #else
231 #if SILC_SIZEOF_INT == 4
232 typedef unsigned long uint32;
233 typedef signed long int32;
234 #else
235 #if SILC_SIZEOF_LONG_LONG >= 4
236 #ifndef WIN32
237 typedef unsigned long long uint32;
238 typedef signed long long int32;
239 #endif
240 #endif
241 #endif
242 #endif
243
244 #if SILC_SIZEOF_LONG >= 8
245 typedef unsigned long uint64;
246 typedef signed long int64;
247 #else
248 #if SILC_SIZEOF_LONG_LONG >= 8
249 #ifndef WIN32
250 typedef unsigned long long uint64;
251 typedef signed long long int64;
252 #else
253 typedef uint32 uint64; /* XXX Use Windows's own 64 bit types */
254 typedef int32 int64;
255 #endif
256 #else
257 typedef uint32 uint64;
258 typedef int32 int64;
259 #endif
260 #endif
261
262 #if SILC_SIZEOF_VOID_P < 4
263 typedef uint32 * void *;
264 #endif
265
266 #ifndef __cplusplus
267 #ifndef bool
268 #define bool unsigned char
269 #endif
270 #endif
271
272 /* Generic global SILC includes */
273 #include "bitmove.h"
274
275 /* Math library includes */
276 #include "silcmp.h"
277 #include "silcmath.h"
278
279 /* Crypto library includes */
280 #include "silccipher.h"
281 #include "silchash.h"
282 #include "silchmac.h"
283 #include "silcrng.h"
284 #include "silcpkcs.h"
285
286 /* SILC util library includes */
287 #include "silcmutex.h"
288 #include "silcthread.h"
289 #include "silcschedule.h"
290 #include "silchashtable.h"
291 #include "silclog.h"
292 #include "silcmemory.h"
293 #include "silclist.h"
294 #include "silcdlist.h"
295 #include "silcbuffer.h"
296 #include "silcbuffmt.h"
297 #include "silcnet.h"
298 #include "silcfileutil.h"
299 #include "silcutil.h"
300 #include "silcconfig.h"
301 #include "silcprotocol.h"
302 #include "silcsockconn.h"
303
304 /* SILC core library includes */
305 #include "silcid.h"
306 #include "silcidcache.h"
307 #include "silcargument.h"
308 #include "silccommand.h"
309 #include "silcchannel.h"
310 #include "silcpacket.h"
311 #include "silcnotify.h"
312 #include "silcmode.h"
313 #include "silcauth.h"
314 #include "silcprivate.h"
315
316 #ifdef SILC_SIM
317 /* SILC Module library includes */
318 #include "silcsim.h"
319 #include "silcsimutil.h"
320 #endif
321
322 /* SILC Key Exchange library includes */
323 #include "silcske.h"
324 #include "silcske_payload.h"
325 #include "silcske_groups.h"
326
327 /* SILC SFTP library */
328 #include "silcsftp.h"
329 #include "silcsftp_fs.h"
330
331 #ifdef __cplusplus
332 }
333 #endif
334
335 #endif /* SILCINCLUDES_H */