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