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