]> sjero.net Git - wget/blob - src/mswindows.h
[svn] Get rid of ssl_iread/ssl_iwrite. Have the SSL code register its
[wget] / src / mswindows.h
1 /* Declarations for windows
2    Copyright (C) 1995, 1997, 1997, 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU Wget.
5
6 GNU Wget is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 GNU Wget is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Wget; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 In addition, as a special exception, the Free Software Foundation
21 gives permission to link the code of its release of Wget with the
22 OpenSSL project's "OpenSSL" library (or with modified versions of it
23 that use the same license as the "OpenSSL" library), and distribute
24 the linked executables.  You must obey the GNU General Public License
25 in all respects for all of the code used other than "OpenSSL".  If you
26 modify this file, you may extend this exception to your version of the
27 file, but you are not obligated to do so.  If you do not wish to do
28 so, delete this exception statement from your version.  */
29
30 #ifndef MSWINDOWS_H
31 #define MSWINDOWS_H
32
33 #ifndef WGET_H
34 #error Include mswindows.h inside or after "wget.h"
35 #endif
36
37 #ifndef WIN32_LEAN_AND_MEAN
38 #define WIN32_LEAN_AND_MEAN  /* Prevent inclusion of <winsock*.h> in <windows.h> */
39 #endif
40
41 #include <windows.h>
42
43 /* Use the correct winsock header; <ws2tcpip.h> includes <winsock2.h> only on
44  * Watcom/MingW. We cannot use <winsock.h> for IPv6. Using getaddrinfo() requires
45  * <ws2tcpip.h>
46  */
47 #if defined(ENABLE_IPV6) || defined(HAVE_GETADDRINFO)
48 # include <winsock2.h>
49 # include <ws2tcpip.h>
50 #else
51 # include <winsock.h>
52 #endif
53
54 #ifndef EAI_SYSTEM
55 # define EAI_SYSTEM -1   /* value doesn't matter */
56 #endif
57
58 /* Must include <sys/stat.h> because of 'stat' define below. */
59 #include <sys/stat.h>
60
61 /* Missing in several .c files. Include here. */
62 #include <io.h>
63
64 /* Apparently needed for alloca(). */
65 #include <malloc.h>
66
67 #ifndef S_ISDIR
68 # define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
69 #endif
70 #ifndef S_ISLNK
71 # define S_ISLNK(a) 0
72 #endif
73
74 /* We have strcasecmp and strncasecmp, just under a different name. */
75 #define strcasecmp stricmp
76 #define strncasecmp strnicmp
77
78 /* The same for snprintf() and vsnprintf().  */
79 #define snprintf _snprintf
80 #define vsnprintf _vsnprintf
81
82 /* No stat on Windows.  */
83 #define lstat stat
84
85 #define PATH_SEPARATOR '\\'
86
87 /* Microsoft says stat is _stat, Borland doesn't */
88 #ifdef _MSC_VER
89 # define stat _stat
90 #endif
91
92 #ifdef HAVE_ISATTY
93 /* Microsoft VC supports _isatty; Borland ? */
94 #ifdef _MSC_VER
95 # define isatty _isatty
96 #endif
97 #endif
98
99 #define REALCLOSE(x) closesocket (x)
100
101 /* #### Do we need this?  */
102 #include <direct.h>
103
104 /* Windows compilers accept only one arg to mkdir. */
105 #ifndef __BORLANDC__
106 # define mkdir(a, b) _mkdir(a)
107 #else  /* __BORLANDC__ */
108 # define mkdir(a, b) mkdir(a)
109 #endif /* __BORLANDC__ */
110
111 /* Declarations of various socket errors: */
112
113 #define EWOULDBLOCK             WSAEWOULDBLOCK
114 #define EINPROGRESS             WSAEINPROGRESS
115 #define EALREADY                WSAEALREADY
116 #define ENOTSOCK                WSAENOTSOCK
117 #define EDESTADDRREQ            WSAEDESTADDRREQ
118 #define EMSGSIZE                WSAEMSGSIZE
119 #define EPROTOTYPE              WSAEPROTOTYPE
120 #define ENOPROTOOPT             WSAENOPROTOOPT
121 #define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
122 #define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
123 #define EOPNOTSUPP              WSAEOPNOTSUPP
124 #define EPFNOSUPPORT            WSAEPFNOSUPPORT
125 #define EAFNOSUPPORT            WSAEAFNOSUPPORT
126 #define EADDRINUSE              WSAEADDRINUSE
127 #define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
128 #define ENETDOWN                WSAENETDOWN
129 #define ENETUNREACH             WSAENETUNREACH
130 #define ENETRESET               WSAENETRESET
131 #define ECONNABORTED            WSAECONNABORTED
132 #define ECONNRESET              WSAECONNRESET
133 #define ENOBUFS                 WSAENOBUFS
134 #define EISCONN                 WSAEISCONN
135 #define ENOTCONN                WSAENOTCONN
136 #define ESHUTDOWN               WSAESHUTDOWN
137 #define ETOOMANYREFS            WSAETOOMANYREFS
138 #define ETIMEDOUT               WSAETIMEDOUT
139 #define ECONNREFUSED            WSAECONNREFUSED
140 #define ELOOP                   WSAELOOP
141 #define EHOSTDOWN               WSAEHOSTDOWN
142 #define EHOSTUNREACH            WSAEHOSTUNREACH
143 #define EPROCLIM                WSAEPROCLIM
144 #define EUSERS                  WSAEUSERS
145 #define EDQUOT                  WSAEDQUOT
146 #define ESTALE                  WSAESTALE
147 #define EREMOTE                 WSAEREMOTE
148
149 /* Public functions.  */
150
151 #ifndef HAVE_SLEEP
152 unsigned int sleep (unsigned);
153 #endif
154 #ifndef HAVE_USLEEP
155 int usleep (unsigned long);
156 #endif
157
158 void ws_startup (void);
159 void ws_changetitle (const char*, int);
160 void ws_percenttitle (double);
161 char *ws_mypath (void);
162 void ws_help (const char *);
163 void windows_main_junk (int *, char **, char **);
164
165 /* Things needed for IPv6; missing in <ws2tcpip.h>. */
166 #ifdef ENABLE_IPV6
167 # ifndef HAVE_NTOP
168   extern const char *inet_ntop (int af, const void *src, char *dst, size_t size);
169 # endif
170 # ifndef HAVE_PTON
171   extern int inet_pton (int af, const char *src, void *dst);
172 # endif
173 #endif /* ENABLE_IPV6 */
174
175 #endif /* MSWINDOWS_H */