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