1 | /*
|
---|
2 | * OpenVPN -- An application to securely tunnel IP networks
|
---|
3 | * over a single UDP port, with support for SSL/TLS-based
|
---|
4 | * session authentication and key exchange,
|
---|
5 | * packet encryption, packet authentication, and
|
---|
6 | * packet compression.
|
---|
7 | *
|
---|
8 | * Copyright (C) 2002-2005 OpenVPN Solutions LLC <[email protected]>
|
---|
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 version 2
|
---|
12 | * as published by the Free Software Foundation.
|
---|
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 | * You should have received a copy of the GNU General Public License
|
---|
20 | * along with this program (see the file COPYING included with this
|
---|
21 | * distribution); if not, write to the Free Software Foundation, Inc.,
|
---|
22 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | */
|
---|
24 |
|
---|
25 | /*
|
---|
26 | * Configuration header for Win32 using the mingw environment.
|
---|
27 | * Manually edited based on linux version as generated by autoconf.
|
---|
28 | *
|
---|
29 | * config-win32.h is normally generated by copying
|
---|
30 | * config-win32.h.in -> config-win32.h and replacing
|
---|
31 | * [ampersand] VERSION [ampersand]
|
---|
32 | * with the appropriate version #. This is normally
|
---|
33 | * done automatically by configure.ac
|
---|
34 | */
|
---|
35 |
|
---|
36 | #include <windows.h>
|
---|
37 | #include <winsock2.h>
|
---|
38 |
|
---|
39 | #define sleep(x) Sleep((x)*1000)
|
---|
40 |
|
---|
41 | #define random rand
|
---|
42 | #define srandom srand
|
---|
43 |
|
---|
44 | typedef unsigned long in_addr_t;
|
---|
45 |
|
---|
46 | #ifndef _SSIZE_T_
|
---|
47 | #define _SSIZE_T_
|
---|
48 | typedef unsigned int ssize_t;
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | /* Append a label to program startup title */
|
---|
52 | //#define DEBUG_LABEL "DEBUG1"
|
---|
53 |
|
---|
54 | /* Should we print debug info from driver? */
|
---|
55 | //#define TAP_WIN32_DEBUG
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * Minimum TAP-Win32 version number expected by userspace
|
---|
59 | *
|
---|
60 | * The TAP-Win32 version number is defined in tap-win32/SOURCES
|
---|
61 | */
|
---|
62 | #define TAP_WIN32_MIN_MAJOR 8
|
---|
63 | #define TAP_WIN32_MIN_MINOR 4
|
---|
64 |
|
---|
65 | /* Allow --askpass and --auth-user-pass passwords to be read from a file */
|
---|
66 | /* #undef ENABLE_PASSWORD_SAVE */
|
---|
67 |
|
---|
68 | /* Enable client/server capability */
|
---|
69 | #define ENABLE_CLIENT_SERVER 1
|
---|
70 |
|
---|
71 | /* Enable client capability only */
|
---|
72 | /* #undef ENABLE_CLIENT_ONLY */
|
---|
73 |
|
---|
74 | /* Enable management server capability */
|
---|
75 | #define ENABLE_MANAGEMENT 1
|
---|
76 |
|
---|
77 | /* Enable HTTP proxy support */
|
---|
78 | #define ENABLE_HTTP_PROXY 1
|
---|
79 |
|
---|
80 | /* Enable Socks proxy support */
|
---|
81 | #define ENABLE_SOCKS 1
|
---|
82 |
|
---|
83 | /* Enable internal fragmentation support */
|
---|
84 | #define ENABLE_FRAGMENT 1
|
---|
85 |
|
---|
86 | /* Enable smaller executable size */
|
---|
87 | /* #undef ENABLE_SMALL */
|
---|
88 |
|
---|
89 | /* Enable debugging support */
|
---|
90 | #define ENABLE_DEBUG 1
|
---|
91 |
|
---|
92 | /* if defined, will allow usage of the --plugin directive */
|
---|
93 | #define USE_LOAD_LIBRARY
|
---|
94 |
|
---|
95 | /* Dimension size to use for empty array declaration */
|
---|
96 | #define EMPTY_ARRAY_SIZE 0
|
---|
97 |
|
---|
98 | /* Define to 1 if you have the <openssl/engine.h> header file. */
|
---|
99 | #define HAVE_OPENSSL_ENGINE_H 1
|
---|
100 |
|
---|
101 | /* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
|
---|
102 | #define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
|
---|
103 |
|
---|
104 | /* Define to 1 if you have the `ENGINE_register_all_complete' function. */
|
---|
105 | #define HAVE_ENGINE_REGISTER_ALL_COMPLETE 1
|
---|
106 |
|
---|
107 | /* Define to 1 if you have the `ENGINE_cleanup' function. */
|
---|
108 | #define HAVE_ENGINE_CLEANUP 1
|
---|
109 |
|
---|
110 | /* gettimeofday() is implemented in otime.c for Windows */
|
---|
111 | #define HAVE_GETTIMEOFDAY 1
|
---|
112 |
|
---|
113 | /* Define to 1 if you have the 'chsize' function. */
|
---|
114 | #define HAVE_CHSIZE 1
|
---|
115 |
|
---|
116 | /* Define to 1 if you have the `chdir' function. */
|
---|
117 | #define HAVE_CHDIR 1
|
---|
118 |
|
---|
119 | /* Define to 1 if your compiler supports GNU GCC-style variadic macros */
|
---|
120 | #ifndef _MSC_VER /* Defines MSFT compiler version. Defined as 1200 for MSVC++ 6.0. */
|
---|
121 | #define HAVE_CPP_VARARG_MACRO_GCC 1
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | /* Define to 1 if you have the <ctype.h> header file. */
|
---|
125 | #define HAVE_CTYPE_H 1
|
---|
126 |
|
---|
127 | /* Define to 1 if you have the <errno.h> header file. */
|
---|
128 | #define HAVE_ERRNO_H 1
|
---|
129 |
|
---|
130 | /* Define to 1 if you have the `EVP_CIPHER_CTX_set_key_length' function. */
|
---|
131 | #define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1
|
---|
132 |
|
---|
133 | /* Define to 1 if you have the <fcntl.h> header file. */
|
---|
134 | #define HAVE_FCNTL_H 1
|
---|
135 |
|
---|
136 | /* Define to 1 if you have the `getsockopt' function. */
|
---|
137 | #define HAVE_GETSOCKOPT 1
|
---|
138 |
|
---|
139 | /* Define to 1 if you have the `inet_ntoa' function. */
|
---|
140 | #define HAVE_INET_NTOA 1
|
---|
141 |
|
---|
142 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
---|
143 | to 0 otherwise. */
|
---|
144 | #define HAVE_MALLOC 1
|
---|
145 |
|
---|
146 | /* Define to 1 if you have the `memset' function. */
|
---|
147 | #define HAVE_MEMSET 1
|
---|
148 |
|
---|
149 | /* Define to 1 if you have the `setsockopt' function. */
|
---|
150 | #define HAVE_SETSOCKOPT 1
|
---|
151 |
|
---|
152 | /* Define to 1 if you have the `socket' function. */
|
---|
153 | #define HAVE_SOCKET 1
|
---|
154 |
|
---|
155 | /* Define to 1 if you have the <stdarg.h> header file. */
|
---|
156 | #define HAVE_STDARG_H 1
|
---|
157 |
|
---|
158 | /* Define to 1 if you have the <stdint.h> header file. */
|
---|
159 | #ifndef _MSC_VER
|
---|
160 | #define HAVE_STDINT_H 1
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | /* Define to 1 if you have the <stdio.h> header file. */
|
---|
164 | #define HAVE_STDIO_H 1
|
---|
165 |
|
---|
166 | /* Define to 1 if you have the <stdlib.h> header file. */
|
---|
167 | #define HAVE_STDLIB_H 1
|
---|
168 |
|
---|
169 | /* Define to 1 if you have the `strerror' function. */
|
---|
170 | #define HAVE_STRERROR 1
|
---|
171 |
|
---|
172 | /* Define to 1 if you have the <strings.h> header file. */
|
---|
173 | #define HAVE_STRINGS_H 1
|
---|
174 |
|
---|
175 | /* Define to 1 if you have the <string.h> header file. */
|
---|
176 | #define HAVE_STRING_H 1
|
---|
177 |
|
---|
178 | /* Define to 1 if you have the `system' function. */
|
---|
179 | #define HAVE_SYSTEM 1
|
---|
180 |
|
---|
181 | /* Define to 1 if you have the <sys/file.h> header file. */
|
---|
182 | #ifndef _MSC_VER
|
---|
183 | #define HAVE_SYS_FILE_H 1
|
---|
184 | #endif
|
---|
185 |
|
---|
186 | /* Define to 1 if you have the <sys/stat.h> header file. */
|
---|
187 | #define HAVE_SYS_STAT_H 1
|
---|
188 |
|
---|
189 | /* Define to 1 if you have the <sys/time.h> header file. */
|
---|
190 | #ifndef _MSC_VER
|
---|
191 | #define HAVE_SYS_TIME_H 1
|
---|
192 | #endif
|
---|
193 |
|
---|
194 | /* Define to 1 if you have the <sys/types.h> header file. */
|
---|
195 | #define HAVE_SYS_TYPES_H 1
|
---|
196 |
|
---|
197 | /* Define to 1 if you have the `time' function. */
|
---|
198 | #define HAVE_TIME 1
|
---|
199 |
|
---|
200 | /* Define to 1 if you have the <unistd.h> header file. */
|
---|
201 | #ifndef _MSC_VER
|
---|
202 | #define HAVE_UNISTD_H 1
|
---|
203 | #endif
|
---|
204 |
|
---|
205 | /* Define to 1 if you have the `vsnprintf' function. */
|
---|
206 | #define HAVE_VSNPRINTF 1
|
---|
207 |
|
---|
208 | /* Special Windows version of getpass() defined in io.c */
|
---|
209 | #define HAVE_GETPASS 1
|
---|
210 |
|
---|
211 | /* Name of package */
|
---|
212 | #define PACKAGE "openvpn"
|
---|
213 |
|
---|
214 | /* Define to the address where bug reports for this package should be sent. */
|
---|
215 | #define PACKAGE_BUGREPORT "[email protected]"
|
---|
216 |
|
---|
217 | /* Define to the full name of this package. */
|
---|
218 | #define PACKAGE_NAME "OpenVPN"
|
---|
219 |
|
---|
220 | /* Define to the one symbol short name of this package. */
|
---|
221 | #define PACKAGE_TARNAME "openvpn"
|
---|
222 |
|
---|
223 | /* Define to the version of this package. */
|
---|
224 | #define PACKAGE_VERSION "@VERSION@" /* AUTO_VERSION */
|
---|
225 |
|
---|
226 | /* Define to the full name and version of this package. */
|
---|
227 | #ifdef DEBUG_LABEL
|
---|
228 | #define PACKAGE_STRING "OpenVPN " PACKAGE_VERSION " " DEBUG_LABEL
|
---|
229 | #else
|
---|
230 | #define PACKAGE_STRING "OpenVPN " PACKAGE_VERSION
|
---|
231 | #endif
|
---|
232 |
|
---|
233 | /* Define as the return type of signal handlers (`int' or `void'). */
|
---|
234 | #define RETSIGTYPE void
|
---|
235 |
|
---|
236 | /* The size of a `unsigned int', as computed by sizeof. */
|
---|
237 | #define SIZEOF_UNSIGNED_INT 4
|
---|
238 |
|
---|
239 | /* The size of a `unsigned long', as computed by sizeof. */
|
---|
240 | #define SIZEOF_UNSIGNED_LONG 4
|
---|
241 |
|
---|
242 | /* Define to 1 if you have the ANSI C header files. */
|
---|
243 | #define STDC_HEADERS 1
|
---|
244 |
|
---|
245 | /* A string representing our target */
|
---|
246 | #ifdef _MSC_VER
|
---|
247 | #define TARGET_ALIAS "Win32-MSVC++"
|
---|
248 | #else
|
---|
249 | #define TARGET_ALIAS "Win32-MinGW"
|
---|
250 | #endif
|
---|
251 |
|
---|
252 | /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
---|
253 | #ifndef _MSC_VER
|
---|
254 | #define TIME_WITH_SYS_TIME 1
|
---|
255 | #endif
|
---|
256 |
|
---|
257 | /* Use OpenSSL crypto library */
|
---|
258 | #define USE_CRYPTO 1
|
---|
259 |
|
---|
260 | /* Use LZO compression library */
|
---|
261 | #define USE_LZO 1
|
---|
262 |
|
---|
263 | /* Use OpenSSL SSL library */
|
---|
264 | #define USE_SSL 1
|
---|
265 |
|
---|
266 | /* Version number of package */
|
---|
267 | #define VERSION PACKAGE_VERSION
|
---|
268 |
|
---|
269 | /* Define as `__inline' if that's what the C compiler calls it, or to nothing
|
---|
270 | if it is not supported. */
|
---|
271 | #define inline __inline
|
---|
272 |
|
---|
273 | /* type to use in place of socklen_t if not defined */
|
---|
274 | #define socklen_t unsigned int
|
---|
275 |
|
---|
276 | /* 32-bit unsigned type */
|
---|
277 | #define uint32_t unsigned int
|
---|
278 |
|
---|
279 | /* 16-bit unsigned type */
|
---|
280 | #define uint16_t unsigned short
|
---|
281 |
|
---|
282 | /* 8-bit unsigned type */
|
---|
283 | #define uint8_t unsigned char
|
---|
284 |
|
---|
285 | /* Route command */
|
---|
286 | #define ROUTE_PATH "route"
|
---|
287 |
|
---|
288 | /* Windows doesn't support PTHREAD yet */
|
---|
289 | #ifdef USE_PTHREAD
|
---|
290 | #error The Windows version of OpenVPN does not support PTHREAD yet
|
---|
291 | #endif
|
---|
292 |
|
---|
293 | #ifdef _MSC_VER
|
---|
294 | /* MSVC++ hacks */
|
---|
295 | #include <io.h>
|
---|
296 | #include <direct.h>
|
---|
297 | #define vsnprintf _vsnprintf
|
---|
298 | #define vsnwprintf _vsnwprintf
|
---|
299 | #define snwprintf _snwprintf
|
---|
300 | #define write _write
|
---|
301 | #define open _open
|
---|
302 | #define read _read
|
---|
303 | #define close _close
|
---|
304 | #define chdir _chdir
|
---|
305 | #define S_IRUSR 0
|
---|
306 | #define S_IWUSR 0
|
---|
307 | typedef int intptr_t;
|
---|
308 | #undef S_NORMAL
|
---|
309 | #endif
|
---|