HTTP_DealWithProxy: Only add http:// to proxy string when needed.
[wine/multimedia.git] / dlls / wininet / internet.h
blobfecba7ce92a4f37d3a11087567a71a9fbf4e62af
1 /*
2 * Wininet
4 * Copyright 1999 Corel Corporation
6 * Ulrich Czekalla
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef _WINE_INTERNET_H_
24 #define _WINE_INTERNET_H_
26 #include <time.h>
27 #ifdef HAVE_NETDB_H
28 # include <netdb.h>
29 #endif
30 #ifdef HAVE_NETINET_IN_H
31 # include <sys/types.h>
32 # include <netinet/in.h>
33 #endif
34 #ifdef HAVE_OPENSSL_SSL_H
35 #define DSA __ssl_DSA /* avoid conflict with commctrl.h */
36 #undef FAR
37 # include <openssl/ssl.h>
38 #undef FAR
39 #define FAR do_not_use_this_in_wine
40 #undef DSA
41 #endif
42 #ifdef HAVE_SYS_SOCKET_H
43 # include <sys/socket.h>
44 #endif
46 /* used for netconnection.c stuff */
47 typedef struct
49 BOOL useSSL;
50 int socketFD;
51 #ifdef HAVE_OPENSSL_SSL_H
52 SSL *ssl_s;
53 int ssl_sock;
54 #endif
55 } WININET_NETCONNECTION;
57 typedef enum
59 WH_HINIT = INTERNET_HANDLE_TYPE_INTERNET,
60 WH_HFTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_FTP,
61 WH_HGOPHERSESSION = INTERNET_HANDLE_TYPE_CONNECT_GOPHER,
62 WH_HHTTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_HTTP,
63 WH_HFILE = INTERNET_HANDLE_TYPE_FTP_FILE,
64 WH_HFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND,
65 WH_HHTTPREQ = INTERNET_HANDLE_TYPE_HTTP_REQUEST,
66 } WH_TYPE;
68 typedef struct _WININETHANDLEHEADER
70 WH_TYPE htype;
71 DWORD dwFlags;
72 DWORD dwContext;
73 DWORD dwError;
74 struct _WININETHANDLEHEADER *lpwhparent;
75 } WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
78 typedef struct
80 WININETHANDLEHEADER hdr;
81 LPSTR lpszAgent;
82 LPSTR lpszProxy;
83 LPSTR lpszProxyBypass;
84 LPSTR lpszProxyUsername;
85 LPSTR lpszProxyPassword;
86 DWORD dwAccessType;
87 INTERNET_STATUS_CALLBACK lpfnStatusCB;
88 } WININETAPPINFOA, *LPWININETAPPINFOA;
91 typedef struct
93 WININETHANDLEHEADER hdr;
94 LPSTR lpszServerName;
95 LPSTR lpszUserName;
96 INTERNET_PORT nServerPort;
97 struct sockaddr_in socketAddress;
98 struct hostent *phostent;
99 } WININETHTTPSESSIONA, *LPWININETHTTPSESSIONA;
101 #define HDR_ISREQUEST 0x0001
102 #define HDR_COMMADELIMITED 0x0002
103 #define HDR_SEMIDELIMITED 0x0004
105 typedef struct
107 LPSTR lpszField;
108 LPSTR lpszValue;
109 WORD wFlags;
110 WORD wCount;
111 } HTTPHEADERA, *LPHTTPHEADERA;
114 typedef struct
116 WININETHANDLEHEADER hdr;
117 LPSTR lpszPath;
118 LPSTR lpszVerb;
119 LPSTR lpszHostName;
120 WININET_NETCONNECTION netConnection;
121 HTTPHEADERA StdHeaders[HTTP_QUERY_MAX+1];
122 HTTPHEADERA *pCustHeaders;
123 INT nCustHeaders;
124 } WININETHTTPREQA, *LPWININETHTTPREQA;
127 typedef struct
129 WININETHANDLEHEADER hdr;
130 BOOL session_deleted;
131 int nDataSocket;
132 } WININETFILE, *LPWININETFILE;
135 typedef struct
137 WININETHANDLEHEADER hdr;
138 int sndSocket;
139 int lstnSocket;
140 int pasvSocket; /* data socket connected by us in case of passive FTP */
141 LPWININETFILE download_in_progress;
142 struct sockaddr_in socketAddress;
143 struct sockaddr_in lstnSocketAddress;
144 struct hostent *phostent;
145 LPSTR lpszPassword;
146 LPSTR lpszUserName;
147 } WININETFTPSESSIONA, *LPWININETFTPSESSIONA;
150 typedef struct
152 BOOL bIsDirectory;
153 LPSTR lpszName;
154 DWORD nSize;
155 struct tm tmLastModified;
156 unsigned short permissions;
157 } FILEPROPERTIESA, *LPFILEPROPERTIESA;
160 typedef struct
162 WININETHANDLEHEADER hdr;
163 int index;
164 DWORD size;
165 LPFILEPROPERTIESA lpafp;
166 } WININETFINDNEXTA, *LPWININETFINDNEXTA;
168 typedef enum
170 FTPPUTFILEA,
171 FTPSETCURRENTDIRECTORYA,
172 FTPCREATEDIRECTORYA,
173 FTPFINDFIRSTFILEA,
174 FTPGETCURRENTDIRECTORYA,
175 FTPOPENFILEA,
176 FTPGETFILEA,
177 FTPDELETEFILEA,
178 FTPREMOVEDIRECTORYA,
179 FTPRENAMEFILEA,
180 INTERNETFINDNEXTA,
181 HTTPSENDREQUESTA,
182 HTTPOPENREQUESTA,
183 SENDCALLBACK,
184 } ASYNC_FUNC;
186 struct WORKREQ_FTPPUTFILEA
188 LPSTR lpszLocalFile;
189 LPSTR lpszNewRemoteFile;
190 DWORD dwFlags;
191 DWORD dwContext;
194 struct WORKREQ_FTPSETCURRENTDIRECTORYA
196 LPSTR lpszDirectory;
199 struct WORKREQ_FTPCREATEDIRECTORYA
201 LPSTR lpszDirectory;
204 struct WORKREQ_FTPFINDFIRSTFILEA
206 LPSTR lpszSearchFile;
207 LPWIN32_FIND_DATAA lpFindFileData;
208 DWORD dwFlags;
209 DWORD dwContext;
212 struct WORKREQ_FTPGETCURRENTDIRECTORYA
214 LPSTR lpszDirectory;
215 DWORD *lpdwDirectory;
218 struct WORKREQ_FTPOPENFILEA
220 LPSTR lpszFilename;
221 DWORD dwAccess;
222 DWORD dwFlags;
223 DWORD dwContext;
226 struct WORKREQ_FTPGETFILEA
228 LPSTR lpszRemoteFile;
229 LPSTR lpszNewFile;
230 BOOL fFailIfExists;
231 DWORD dwLocalFlagsAttribute;
232 DWORD dwFlags;
233 DWORD dwContext;
236 struct WORKREQ_FTPDELETEFILEA
238 LPSTR lpszFilename;
241 struct WORKREQ_FTPREMOVEDIRECTORYA
243 LPSTR lpszDirectory;
246 struct WORKREQ_FTPRENAMEFILEA
248 LPSTR lpszSrcFile;
249 LPSTR lpszDestFile;
252 struct WORKREQ_INTERNETFINDNEXTA
254 LPWIN32_FIND_DATAA lpFindFileData;
257 struct WORKREQ_HTTPOPENREQUESTA
259 LPSTR lpszVerb;
260 LPSTR lpszObjectName;
261 LPSTR lpszVersion;
262 LPSTR lpszReferrer;
263 LPCSTR *lpszAcceptTypes;
264 DWORD dwFlags;
265 DWORD dwContext;
268 struct WORKREQ_HTTPSENDREQUESTA
270 LPSTR lpszHeader;
271 DWORD dwHeaderLength;
272 LPVOID lpOptional;
273 DWORD dwOptionalLength;
276 struct WORKREQ_SENDCALLBACK
278 HINTERNET hHttpSession;
279 DWORD dwContext;
280 DWORD dwInternetStatus;
281 LPVOID lpvStatusInfo;
282 DWORD dwStatusInfoLength;
285 typedef struct WORKREQ
287 ASYNC_FUNC asyncall;
288 HINTERNET handle;
290 union {
291 struct WORKREQ_FTPPUTFILEA FtpPutFileA;
292 struct WORKREQ_FTPSETCURRENTDIRECTORYA FtpSetCurrentDirectoryA;
293 struct WORKREQ_FTPCREATEDIRECTORYA FtpCreateDirectoryA;
294 struct WORKREQ_FTPFINDFIRSTFILEA FtpFindFirstFileA;
295 struct WORKREQ_FTPGETCURRENTDIRECTORYA FtpGetCurrentDirectoryA;
296 struct WORKREQ_FTPOPENFILEA FtpOpenFileA;
297 struct WORKREQ_FTPGETFILEA FtpGetFileA;
298 struct WORKREQ_FTPDELETEFILEA FtpDeleteFileA;
299 struct WORKREQ_FTPREMOVEDIRECTORYA FtpRemoveDirectoryA;
300 struct WORKREQ_FTPRENAMEFILEA FtpRenameFileA;
301 struct WORKREQ_INTERNETFINDNEXTA InternetFindNextA;
302 struct WORKREQ_HTTPOPENREQUESTA HttpOpenRequestA;
303 struct WORKREQ_HTTPSENDREQUESTA HttpSendRequestA;
304 struct WORKREQ_SENDCALLBACK SendCallback;
305 } u;
307 struct WORKREQ *next;
308 struct WORKREQ *prev;
310 } WORKREQUEST, *LPWORKREQUEST;
313 time_t ConvertTimeString(LPCSTR asctime);
315 HINTERNET FTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
316 INTERNET_PORT nServerPort, LPCSTR lpszUserName,
317 LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
319 HINTERNET HTTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
320 INTERNET_PORT nServerPort, LPCSTR lpszUserName,
321 LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
323 BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
324 struct hostent **phe, struct sockaddr_in *psa);
326 void INTERNET_SetLastError(DWORD dwError);
327 DWORD INTERNET_GetLastError();
328 BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
329 LPSTR INTERNET_GetResponseBuffer();
330 LPSTR INTERNET_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer);
332 BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs);
333 BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn);
334 BOOL FTP_CloseFileTransferHandle(LPWININETFILE lpwfn);
335 BOOLAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
336 LPCSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext);
337 BOOLAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
338 BOOLAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
339 INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
340 LPCSTR lpszSearchFile, LPWIN32_FIND_DATAA lpFindFileData, DWORD dwFlags, DWORD dwContext);
341 BOOLAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory,
342 LPDWORD lpdwCurrentDirectory);
343 BOOL FTP_ConvertFileProp(LPFILEPROPERTIESA lpafp, LPWIN32_FIND_DATAA lpFindFileData);
344 BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest);
345 BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory);
346 BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName);
347 HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession, LPCSTR lpszFileName,
348 DWORD fdwAccess, DWORD dwFlags, DWORD dwContext);
349 BOOLAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszNewFile,
350 BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
351 DWORD dwContext);
353 BOOLAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
354 DWORD dwHeaderLength, LPVOID lpOptional ,DWORD dwOptionalLength);
355 INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
356 LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion,
357 LPCSTR lpszReferrer , LPCSTR *lpszAcceptTypes,
358 DWORD dwFlags, DWORD dwContext);
359 void HTTP_CloseHTTPSessionHandle(LPWININETHTTPSESSIONA lpwhs);
360 void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr);
362 VOID SendAsyncCallback(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
363 DWORD dwContext, DWORD dwInternetStatus, LPVOID
364 lpvStatusInfo , DWORD dwStatusInfoLength);
366 VOID SendAsyncCallbackInt(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
367 DWORD dwContext, DWORD dwInternetStatus, LPVOID
368 lpvStatusInfo , DWORD dwStatusInfoLength);
370 BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQA lpwhr,
371 LPCSTR username, LPCSTR password );
373 BOOL NETCON_connected(WININET_NETCONNECTION *connection);
374 void NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL);
375 BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
376 int type, int protocol);
377 BOOL NETCON_close(WININET_NETCONNECTION *connection);
378 BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
379 socklen_t addrlen);
380 BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags,
381 int *sent /* out */);
382 BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
383 int *recvd /* out */);
384 BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPDWORD dwBuffer);
386 #define MAX_REPLY_LEN 0x5B4
389 #endif /* _WINE_INTERNET_H_ */