updates.
[silc.git] / includes / silcincludes.h
1
2 /*
3
4   silcincludes.h
5
6   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7
8   Copyright (C) 1997 - 2000 Pekka Riikonen
9
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of the GNU General Public License as published by
12   the Free Software Foundation; either version 2 of the License, or
13   (at your option) any later version.
14   
15   This program is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   GNU General Public License for more details.
19
20 */
21 /*
22   This file includes common definitions for SILC. This file MUST be included
23   by all files in SILC (directly or through other global include file).
24 */
25
26 #ifndef SILCINCLUDES_H
27 #define SILCINCLUDES_H
28
29 /* Automatically generated configuration header */
30 #include "silcdefs.h"
31
32 #ifdef SILC_WIN32
33 #include <windows.h>
34 #include <dir.h>
35 #include <io.h>
36 #endif
37
38 #include <stdio.h>
39 #include <stdlib.h>
40 #include <unistd.h>
41 #include <string.h>
42 #include <stdarg.h>
43 #include <ctype.h>
44 #include <sys/types.h>
45 #include <sys/stat.h>
46 #include <sys/time.h>
47 #include <time.h>
48
49 #ifdef HAVE_SIGNAL_H
50 #include <signal.h>
51 #else
52 #error signal.h not found in the system
53 #endif
54
55 #ifdef HAVE_FCNTL_H
56 #include <fcntl.h>
57 #else
58 #error fcntl.h not found in the system
59 #endif
60
61 #ifdef HAVE_ERRNO_H
62 #include <errno.h>
63 #else
64 #error errno.h not found in the system
65 #endif
66
67 #ifdef HAVE_ASSERT_H
68 #include <assert.h>
69 #else
70 #error assert.h not found in the system
71 #endif
72
73 #ifndef SILC_WIN32
74
75 #include <pwd.h>
76 #include <grp.h>
77 #include <sys/times.h>
78
79 #ifdef HAVE_GETOPT_H
80 #include <getopt.h>
81 #endif
82
83 #ifdef SOCKS5
84 #include "socks.h"
85 #endif
86
87 #include <sys/socket.h>
88 #ifdef HAVE_NETINET_IN_H
89 #include <netinet/in.h>
90 #else
91 #error netinet/in.h not found in the system
92 #endif
93
94 #ifdef HAVE_NETINET_TCP_H
95 #include <netinet/tcp.h>
96 #else
97 #error netinet/tcp.h not found in the system
98 #endif
99
100 #ifdef HAVE_NETDB_H
101 #include <netdb.h>
102 #else
103 #error netdb.h not found in the system
104 #endif
105
106 #ifdef HAVE_ARPA_INET_H
107 #include <arpa/inet.h>
108 #else
109 #error arpa/inet.h not found in the system
110 #endif
111
112 #ifdef HAVE_SYS_MMAN_H
113 #include <sys/mman.h>
114 #endif
115
116 #ifdef HAVE_DLFCN_H
117 #include <dlfcn.h>
118 #endif
119
120 #endif                          /* !SILC_WIN32 */
121
122 #ifndef HAVE_GETOPT_LONG
123 #include "../lib/contrib/getopt.h"
124 #endif
125
126 #ifndef HAVE_REGEX_H
127 #include "../lib/contrib/regex.h"
128 #else
129 #include <regex.h>
130 #endif
131
132 #ifndef TRUE
133 #define TRUE 1
134 #endif
135 #ifndef FALSE
136 #define FALSE 0
137 #endif
138
139 /* Define types. The types must be at least of the specified size */
140 #undef uint8
141 #undef uint16
142 #undef uint32
143 #undef uin64
144 #undef int8
145 #undef int16
146 #undef int32
147 #undef int64
148
149 typedef unsigned char uint8;
150 typedef signed char int8;
151
152 #if SILC_SIZEOF_SHORT > 2
153 #error "size of the short must be 2 bytes"
154 #endif
155
156 typedef unsigned short uint16;
157 typedef signed short int16;
158
159 #if SILC_SIZEOF_LONG == 4
160 typedef unsigned long uint32;
161 typedef signed long int32;
162 #else
163 #if SILC_SIZEOF_INT == 4
164 typedef unsigned long uint32;
165 typedef signed long int32;
166 #else
167 #if SILC_SIZEOF_LONG_LONG >= 4
168 typedef unsigned long long uint32;
169 typedef signed long long int32;
170 #endif
171 #endif
172 #endif
173
174 #if SILC_SIZEOF_LONG >= 8
175 typedef unsigned long uint64;
176 typedef signed long int64;
177 #else
178 #if SILC_SIZEOF_LONG_LONG >= 8
179 typedef unsigned long long uint64;
180 typedef signed long long int64;
181 #else
182 typedef uint32 uint64;
183 typedef int32 int64;
184 #endif
185 #endif
186
187 #if SILC_SIZEOF_VOID_P < 4
188 typedef uint32 * void *;
189 #endif
190
191 #ifndef bool
192 #define bool unsigned char
193 #endif
194
195 /* Generic global SILC includes */
196 #include "bitmove.h"
197
198 /* Math library includes */
199 #include "silcmp.h"
200 #include "silcmath.h"
201
202 /* Crypto library includes */
203 #include "silccipher.h"
204 #include "silchash.h"
205 #include "silchmac.h"
206 #include "silcrng.h"
207 #include "silcpkcs.h"
208
209 /* SILC util library includes */
210 #include "silchashtable.h"
211 #include "silclog.h"
212 #include "silcmemory.h"
213 #include "silcbuffer.h"
214 #include "silcbufutil.h"
215 #include "silcbuffmt.h"
216 #include "silcnet.h"
217 #include "silcutil.h"
218 #include "silcconfig.h"
219 #include "silctask.h"
220 #include "silcschedule.h"
221
222 /* SILC core library includes */
223 #include "silcid.h"
224 #include "silcidcache.h"
225 #include "silcprotocol.h"
226 #include "silcsockconn.h"
227 #include "silcpayload.h"
228 #include "silccommand.h"
229 #include "silcchannel.h"
230 #include "silcpacket.h"
231 #include "silcnotify.h"
232 #include "silcmode.h"
233 #include "silcauth.h"
234 #include "silcprivate.h"
235
236 /* TRQ (SilcList API and SilcDList API) */
237 #include "silclist.h"
238 #include "silcdlist.h"
239
240 #ifdef SILC_SIM
241 /* SILC Module library includes */
242 #include "silcsim.h"
243 #include "silcsimutil.h"
244 #endif
245
246 /* SILC Key Exchange library includes */
247 #include "silcske.h"
248 #include "payload.h"
249 #include "groups.h"
250
251 #endif
252