updates.
[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 WIN32
32 #ifndef SILC_WIN32
33 #define SILC_WIN32
34 #endif
35 #endif
36
37 #if defined(__EPOC32__)
38 #ifndef SILC_EPOC
39 #define SILC_EPOC
40 #endif
41 #endif
42
43 #ifdef BEOS
44 #ifndef SILC_BEOS
45 #define SILC_BEOS
46 #endif
47 #elif defined(__BEOS__)
48 #ifndef SILC_BEOS
49 #define SILC_BEOS
50 #endif
51 #endif
52
53 /* Platform specific includes */
54
55 #ifdef SILC_WIN32
56 #include "silcwin32.h"
57 #endif
58
59 #ifdef SILC_EPOC
60 #include "silcepoc.h"
61 #endif
62
63 #ifdef SILC_BEOS
64 #include "silcbeos.h"
65 #endif
66
67 #ifndef DLLAPI
68 #define DLLAPI
69 #endif
70
71 #include <stdio.h>
72 #include <stdlib.h>
73 #include <string.h>
74 #include <stdarg.h>
75 #include <ctype.h>
76 #include <sys/types.h>
77 #include <sys/stat.h>
78 #include <time.h>
79
80 #ifdef HAVE_SIGNAL_H
81 #include <signal.h>
82 #else
83 #error signal.h not found in the system
84 #endif
85
86 #ifdef HAVE_FCNTL_H
87 #include <fcntl.h>
88 #else
89 #error fcntl.h not found in the system
90 #endif
91
92 #ifdef HAVE_ERRNO_H
93 #include <errno.h>
94 #else
95 #error errno.h not found in the system
96 #endif
97
98 #ifdef HAVE_ASSERT_H
99 #include <assert.h>
100 #else
101 #error assert.h not found in the system
102 #endif
103
104 #ifndef SILC_WIN32
105
106 #include <unistd.h>
107 #include <sys/time.h>
108 #include <pwd.h>
109 #include <grp.h>
110 #include <sys/times.h>
111
112 #ifdef HAVE_GETOPT_H
113 #include <getopt.h>
114 #endif
115
116 #ifdef SOCKS5
117 #include "socks.h"
118 #endif
119
120 #include <sys/socket.h>
121 #ifdef HAVE_NETINET_IN_H
122 #include <netinet/in.h>
123 #else
124 #error netinet/in.h not found in the system
125 #endif
126
127 #ifdef HAVE_XTI_H
128 #include <xti.h>
129 #else
130 #ifdef HAVE_NETINET_TCP_H
131 #include <netinet/tcp.h>
132 #else
133 #error xti.h nor even netinet/tcp.h found in the system
134 #endif
135 #endif
136
137 #ifdef HAVE_NETDB_H
138 #include <netdb.h>
139 #else
140 #error netdb.h not found in the system
141 #endif
142
143 #ifdef HAVE_ARPA_INET_H
144 #include <arpa/inet.h>
145 #else
146 #error arpa/inet.h not found in the system
147 #endif
148
149 #ifdef HAVE_SYS_MMAN_H
150 #include <sys/mman.h>
151 #endif
152
153 #ifdef HAVE_DLFCN_H
154 #include <dlfcn.h>
155 #endif
156
157 #ifdef HAVE_LIMITS_H
158 #include <limits.h>
159 #endif
160
161 #ifndef HAVE_REGEX_H
162 #include "../lib/contrib/regex.h"
163 #else
164 #include <regex.h>
165 #endif
166
167 #ifdef SILC_HAVE_PTHREAD
168 #include <pthread.h>
169 #endif
170
171 #ifdef HAVE_STDDEF_H
172 #include <stddef.h>
173 #endif
174
175 #endif                          /* !SILC_WIN32 */
176
177 #ifndef HAVE_GETOPT_LONG
178 #include "../lib/contrib/getopt.h"
179 #endif
180
181 #ifndef TRUE
182 #define TRUE 1
183 #endif
184 #ifndef FALSE
185 #define FALSE 0
186 #endif
187
188 /* Define offsetof */
189 #ifndef offsetof
190 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
191 #endif
192
193 /* Define types. The types must be at least of the specified size */
194 #undef uint8
195 #undef uint16
196 #undef uint32
197 #undef uin64
198 #undef int8
199 #undef int16
200 #undef int32
201 #undef int64
202
203 typedef unsigned char uint8;
204 typedef signed char int8;
205
206 #if SILC_SIZEOF_SHORT > 2
207 #error "size of the short must be 2 bytes"
208 #endif
209
210 typedef unsigned short uint16;
211 typedef signed short int16;
212
213 #if SILC_SIZEOF_LONG == 4
214 typedef unsigned long uint32;
215 typedef signed long int32;
216 #else
217 #if SILC_SIZEOF_INT == 4
218 typedef unsigned long uint32;
219 typedef signed long int32;
220 #else
221 #if SILC_SIZEOF_LONG_LONG >= 4
222 #ifndef WIN32
223 typedef unsigned long long uint32;
224 typedef signed long long int32;
225 #endif
226 #endif
227 #endif
228 #endif
229
230 #if SILC_SIZEOF_LONG >= 8
231 typedef unsigned long uint64;
232 typedef signed long int64;
233 #else
234 #if SILC_SIZEOF_LONG_LONG >= 8
235 #ifndef WIN32
236 typedef unsigned long long uint64;
237 typedef signed long long int64;
238 #else
239 typedef uint32 uint64; /* XXX Use Windows's own 64 bit types */
240 typedef int32 int64;
241 #endif
242 #else
243 typedef uint32 uint64;
244 typedef int32 int64;
245 #endif
246 #endif
247
248 #if SILC_SIZEOF_VOID_P < 4
249 typedef uint32 * void *;
250 #endif
251
252 #ifndef __cplusplus
253 #ifndef bool
254 #define bool unsigned char
255 #endif
256 #endif
257
258 /* Generic global SILC includes */
259 #include "bitmove.h"
260
261 /* Math library includes */
262 #include "silcmp.h"
263 #include "silcmath.h"
264
265 /* Crypto library includes */
266 #include "silccipher.h"
267 #include "silchash.h"
268 #include "silchmac.h"
269 #include "silcrng.h"
270 #include "silcpkcs.h"
271
272 /* SILC util library includes */
273 #include "silcmutex.h"
274 #include "silcthread.h"
275 #include "silcschedule.h"
276 #include "silchashtable.h"
277 #include "silclog.h"
278 #include "silcmemory.h"
279 #include "silclist.h"
280 #include "silcdlist.h"
281 #include "silcbuffer.h"
282 #include "silcbuffmt.h"
283 #include "silcnet.h"
284 #include "silcfileutil.h"
285 #include "silcutil.h"
286 #include "silcconfig.h"
287 #include "silcprotocol.h"
288 #include "silcsockconn.h"
289
290 /* SILC core library includes */
291 #include "silcid.h"
292 #include "silcidcache.h"
293 #include "silcargument.h"
294 #include "silccommand.h"
295 #include "silcchannel.h"
296 #include "silcpacket.h"
297 #include "silcnotify.h"
298 #include "silcmode.h"
299 #include "silcauth.h"
300 #include "silcprivate.h"
301
302 #ifdef SILC_SIM
303 /* SILC Module library includes */
304 #include "silcsim.h"
305 #include "silcsimutil.h"
306 #endif
307
308 /* SILC Key Exchange library includes */
309 #include "silcske.h"
310 #include "silcske_payload.h"
311 #include "silcske_groups.h"
312
313 /* SILC SFTP library */
314 #include "silcsftp.h"
315 #include "silcsftp_fs.h"
316
317 #endif