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_NETINET_TCP_H
98 #include <netinet/tcp.h>
99 #else
100 #error netinet/tcp.h not found in the system
101 #endif
102
103 #ifdef HAVE_NETDB_H
104 #include <netdb.h>
105 #else
106 #error netdb.h not found in the system
107 #endif
108
109 #ifdef HAVE_ARPA_INET_H
110 #include <arpa/inet.h>
111 #else
112 #error arpa/inet.h not found in the system
113 #endif
114
115 #ifdef HAVE_SYS_MMAN_H
116 #include <sys/mman.h>
117 #endif
118
119 #ifdef HAVE_DLFCN_H
120 #include <dlfcn.h>
121 #endif
122
123 #ifdef HAVE_LIMITS_H
124 #include <limits.h>
125 #endif
126
127 #ifndef HAVE_REGEX_H
128 #include "../lib/contrib/regex.h"
129 #else
130 #include <regex.h>
131 #endif
132
133 #endif                          /* !SILC_WIN32 */
134
135 #ifndef HAVE_GETOPT_LONG
136 #include "../lib/contrib/getopt.h"
137 #endif
138
139 #ifndef TRUE
140 #define TRUE 1
141 #endif
142 #ifndef FALSE
143 #define FALSE 0
144 #endif
145
146 /* Define types. The types must be at least of the specified size */
147 #undef uint8
148 #undef uint16
149 #undef uint32
150 #undef uin64
151 #undef int8
152 #undef int16
153 #undef int32
154 #undef int64
155
156 typedef unsigned char uint8;
157 typedef signed char int8;
158
159 #if SILC_SIZEOF_SHORT > 2
160 #error "size of the short must be 2 bytes"
161 #endif
162
163 typedef unsigned short uint16;
164 typedef signed short int16;
165
166 #if SILC_SIZEOF_LONG == 4
167 typedef unsigned long uint32;
168 typedef signed long int32;
169 #else
170 #if SILC_SIZEOF_INT == 4
171 typedef unsigned long uint32;
172 typedef signed long int32;
173 #else
174 #if SILC_SIZEOF_LONG_LONG >= 4
175 typedef unsigned long long uint32;
176 typedef signed long long int32;
177 #endif
178 #endif
179 #endif
180
181 #if SILC_SIZEOF_LONG >= 8
182 typedef unsigned long uint64;
183 typedef signed long int64;
184 #else
185 #if SILC_SIZEOF_LONG_LONG >= 8
186 typedef unsigned long long uint64;
187 typedef signed long long int64;
188 #else
189 typedef uint32 uint64;
190 typedef int32 int64;
191 #endif
192 #endif
193
194 #if SILC_SIZEOF_VOID_P < 4
195 typedef uint32 * void *;
196 #endif
197
198 #ifndef bool
199 #define bool unsigned char
200 #endif
201
202 /* Generic global SILC includes */
203 #include "bitmove.h"
204
205 /* Math library includes */
206 #include "silcmp.h"
207 #include "silcmath.h"
208
209 /* Crypto library includes */
210 #include "silccipher.h"
211 #include "silchash.h"
212 #include "silchmac.h"
213 #include "silcrng.h"
214 #include "silcpkcs.h"
215
216 /* SILC util library includes */
217 #include "silchashtable.h"
218 #include "silclog.h"
219 #include "silcmemory.h"
220 #include "silcbuffer.h"
221 #include "silcbufutil.h"
222 #include "silcbuffmt.h"
223 #include "silcnet.h"
224 #include "silcutil.h"
225 #include "silcconfig.h"
226 #include "silctask.h"
227 #include "silcschedule.h"
228
229 /* SILC core library includes */
230 #include "silcid.h"
231 #include "silcidcache.h"
232 #include "silcprotocol.h"
233 #include "silcsockconn.h"
234 #include "silcpayload.h"
235 #include "silccommand.h"
236 #include "silcchannel.h"
237 #include "silcpacket.h"
238 #include "silcnotify.h"
239 #include "silcmode.h"
240 #include "silcauth.h"
241 #include "silcprivate.h"
242
243 /* TRQ (SilcList API and SilcDList API) */
244 #include "silclist.h"
245 #include "silcdlist.h"
246
247 #ifdef SILC_SIM
248 /* SILC Module library includes */
249 #include "silcsim.h"
250 #include "silcsimutil.h"
251 #endif
252
253 /* SILC Key Exchange library includes */
254 #include "silcske.h"
255 #include "payload.h"
256 #include "groups.h"
257
258 #endif
259