4 * Copyright 1999 Corel Corporation
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 "wine/unicode.h"
32 #ifdef HAVE_NETINET_IN_H
33 # include <sys/types.h>
34 # include <netinet/in.h>
36 #ifdef HAVE_OPENSSL_SSL_H
37 #define DSA __ssl_DSA /* avoid conflict with commctrl.h */
39 # include <openssl/ssl.h>
41 #define FAR do_not_use_this_in_wine
44 #ifdef HAVE_SYS_SOCKET_H
45 # include <sys/socket.h>
48 /* used for netconnection.c stuff */
53 #ifdef HAVE_OPENSSL_SSL_H
57 } WININET_NETCONNECTION;
59 inline static LPSTR WININET_strdup( LPCSTR str )
61 LPSTR ret = HeapAlloc( GetProcessHeap(), 0, strlen(str) + 1 );
62 if (ret) strcpy( ret, str );
66 inline static LPWSTR WININET_strdupW( LPCWSTR str )
68 LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1)*sizeof(WCHAR) );
69 if (ret) strcpyW( ret, str );
75 WH_HINIT = INTERNET_HANDLE_TYPE_INTERNET,
76 WH_HFTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_FTP,
77 WH_HGOPHERSESSION = INTERNET_HANDLE_TYPE_CONNECT_GOPHER,
78 WH_HHTTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_HTTP,
79 WH_HFILE = INTERNET_HANDLE_TYPE_FTP_FILE,
80 WH_HFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND,
81 WH_HHTTPREQ = INTERNET_HANDLE_TYPE_HTTP_REQUEST,
84 typedef struct _WININETHANDLEHEADER
90 struct _WININETHANDLEHEADER *lpwhparent;
91 } WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
96 WININETHANDLEHEADER hdr;
99 LPWSTR lpszProxyBypass;
100 LPWSTR lpszProxyUsername;
101 LPWSTR lpszProxyPassword;
103 INTERNET_STATUS_CALLBACK lpfnStatusCB;
104 } WININETAPPINFOW, *LPWININETAPPINFOW;
109 WININETHANDLEHEADER hdr;
110 LPWSTR lpszServerName;
112 INTERNET_PORT nServerPort;
113 struct sockaddr_in socketAddress;
114 struct hostent *phostent;
115 } WININETHTTPSESSIONW, *LPWININETHTTPSESSIONW;
117 #define HDR_ISREQUEST 0x0001
118 #define HDR_COMMADELIMITED 0x0002
119 #define HDR_SEMIDELIMITED 0x0004
127 } HTTPHEADERW, *LPHTTPHEADERW;
132 WININETHANDLEHEADER hdr;
136 WININET_NETCONNECTION netConnection;
137 HTTPHEADERW StdHeaders[HTTP_QUERY_MAX+1];
138 HTTPHEADERW *pCustHeaders;
140 } WININETHTTPREQW, *LPWININETHTTPREQW;
145 WININETHANDLEHEADER hdr;
146 BOOL session_deleted;
148 } WININETFILE, *LPWININETFILE;
153 WININETHANDLEHEADER hdr;
156 int pasvSocket; /* data socket connected by us in case of passive FTP */
157 LPWININETFILE download_in_progress;
158 struct sockaddr_in socketAddress;
159 struct sockaddr_in lstnSocketAddress;
160 struct hostent *phostent;
163 } WININETFTPSESSIONA, *LPWININETFTPSESSIONA;
171 struct tm tmLastModified;
172 unsigned short permissions;
173 } FILEPROPERTIESA, *LPFILEPROPERTIESA;
178 WININETHANDLEHEADER hdr;
181 LPFILEPROPERTIESA lpafp;
182 } WININETFINDNEXTA, *LPWININETFINDNEXTA;
187 FTPSETCURRENTDIRECTORYA,
190 FTPGETCURRENTDIRECTORYA,
203 struct WORKREQ_FTPPUTFILEA
206 LPSTR lpszNewRemoteFile;
211 struct WORKREQ_FTPSETCURRENTDIRECTORYA
216 struct WORKREQ_FTPCREATEDIRECTORYA
221 struct WORKREQ_FTPFINDFIRSTFILEA
223 LPSTR lpszSearchFile;
224 LPWIN32_FIND_DATAA lpFindFileData;
229 struct WORKREQ_FTPGETCURRENTDIRECTORYA
232 DWORD *lpdwDirectory;
235 struct WORKREQ_FTPOPENFILEA
243 struct WORKREQ_FTPGETFILEA
245 LPSTR lpszRemoteFile;
248 DWORD dwLocalFlagsAttribute;
253 struct WORKREQ_FTPDELETEFILEA
258 struct WORKREQ_FTPREMOVEDIRECTORYA
263 struct WORKREQ_FTPRENAMEFILEA
269 struct WORKREQ_INTERNETFINDNEXTA
271 LPWIN32_FIND_DATAA lpFindFileData;
274 struct WORKREQ_HTTPOPENREQUESTW
277 LPWSTR lpszObjectName;
280 LPCWSTR *lpszAcceptTypes;
285 struct WORKREQ_HTTPSENDREQUESTW
288 DWORD dwHeaderLength;
290 DWORD dwOptionalLength;
293 struct WORKREQ_SENDCALLBACK
295 HINTERNET hHttpSession;
297 DWORD dwInternetStatus;
298 LPVOID lpvStatusInfo;
299 DWORD dwStatusInfoLength;
302 struct WORKREQ_INTERNETOPENURLW
307 DWORD dwHeadersLength;
312 typedef struct WORKREQ
318 struct WORKREQ_FTPPUTFILEA FtpPutFileA;
319 struct WORKREQ_FTPSETCURRENTDIRECTORYA FtpSetCurrentDirectoryA;
320 struct WORKREQ_FTPCREATEDIRECTORYA FtpCreateDirectoryA;
321 struct WORKREQ_FTPFINDFIRSTFILEA FtpFindFirstFileA;
322 struct WORKREQ_FTPGETCURRENTDIRECTORYA FtpGetCurrentDirectoryA;
323 struct WORKREQ_FTPOPENFILEA FtpOpenFileA;
324 struct WORKREQ_FTPGETFILEA FtpGetFileA;
325 struct WORKREQ_FTPDELETEFILEA FtpDeleteFileA;
326 struct WORKREQ_FTPREMOVEDIRECTORYA FtpRemoveDirectoryA;
327 struct WORKREQ_FTPRENAMEFILEA FtpRenameFileA;
328 struct WORKREQ_INTERNETFINDNEXTA InternetFindNextA;
329 struct WORKREQ_HTTPOPENREQUESTW HttpOpenRequestW;
330 struct WORKREQ_HTTPSENDREQUESTW HttpSendRequestW;
331 struct WORKREQ_SENDCALLBACK SendCallback;
332 struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;
335 struct WORKREQ *next;
336 struct WORKREQ *prev;
338 } WORKREQUEST, *LPWORKREQUEST;
340 HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info );
341 LPWININETHANDLEHEADER WININET_GetObject( HINTERNET hinternet );
342 BOOL WININET_FreeHandle( HINTERNET hinternet );
343 HINTERNET WININET_FindHandle( LPWININETHANDLEHEADER info );
345 time_t ConvertTimeString(LPCWSTR asctime);
347 HINTERNET FTP_Connect(HINTERNET hInterent, LPCWSTR lpszServerName,
348 INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
349 LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
351 HINTERNET HTTP_Connect(HINTERNET hInterent, LPCWSTR lpszServerName,
352 INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
353 LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
355 BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
356 struct hostent **phe, struct sockaddr_in *psa);
358 void INTERNET_SetLastError(DWORD dwError);
359 DWORD INTERNET_GetLastError();
360 BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
361 LPSTR INTERNET_GetResponseBuffer();
362 LPSTR INTERNET_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer);
364 BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs);
365 BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn);
366 BOOL FTP_CloseFileTransferHandle(LPWININETFILE lpwfn);
367 BOOLAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
368 LPCSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext);
369 BOOLAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
370 BOOLAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
371 INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
372 LPCSTR lpszSearchFile, LPWIN32_FIND_DATAA lpFindFileData, DWORD dwFlags, DWORD dwContext);
373 BOOLAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory,
374 LPDWORD lpdwCurrentDirectory);
375 BOOL FTP_ConvertFileProp(LPFILEPROPERTIESA lpafp, LPWIN32_FIND_DATAA lpFindFileData);
376 BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest);
377 BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory);
378 BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName);
379 HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession, LPCSTR lpszFileName,
380 DWORD fdwAccess, DWORD dwFlags, DWORD dwContext);
381 BOOLAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszNewFile,
382 BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
385 BOOLAPI HTTP_HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
386 DWORD dwHeaderLength, LPVOID lpOptional ,DWORD dwOptionalLength);
387 INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(HINTERNET hHttpSession,
388 LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion,
389 LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes,
390 DWORD dwFlags, DWORD dwContext);
391 void HTTP_CloseHTTPSessionHandle(LPWININETHTTPSESSIONW lpwhs);
392 void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQW lpwhr);
394 VOID SendAsyncCallback(LPWININETAPPINFOW hIC, HINTERNET hHttpSession,
395 DWORD dwContext, DWORD dwInternetStatus, LPVOID
396 lpvStatusInfo , DWORD dwStatusInfoLength);
398 VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, HINTERNET hHttpSession,
399 DWORD dwContext, DWORD dwInternetStatus, LPVOID
400 lpvStatusInfo , DWORD dwStatusInfoLength);
402 BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr,
403 LPCWSTR username, LPCWSTR password );
405 BOOL NETCON_connected(WININET_NETCONNECTION *connection);
406 void NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL);
407 BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
408 int type, int protocol);
409 BOOL NETCON_close(WININET_NETCONNECTION *connection);
410 BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
412 BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags,
413 int *sent /* out */);
414 BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
415 int *recvd /* out */);
416 BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPDWORD dwBuffer);
418 #define MAX_REPLY_LEN 0x5B4
420 /* Used for debugging - maybe need to be shared in the Wine debugging code ? */
427 #endif /* _WINE_INTERNET_H_ */