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