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_
30 #ifdef HAVE_NETINET_IN_H
31 # include <sys/types.h>
32 # include <netinet/in.h>
37 WH_HINIT
= INTERNET_HANDLE_TYPE_INTERNET
,
38 WH_HFTPSESSION
= INTERNET_HANDLE_TYPE_CONNECT_FTP
,
39 WH_HGOPHERSESSION
= INTERNET_HANDLE_TYPE_CONNECT_GOPHER
,
40 WH_HHTTPSESSION
= INTERNET_HANDLE_TYPE_CONNECT_HTTP
,
41 WH_HFILE
= INTERNET_HANDLE_TYPE_FTP_FILE
,
42 WH_HFINDNEXT
= INTERNET_HANDLE_TYPE_FTP_FIND
,
43 WH_HHTTPREQ
= INTERNET_HANDLE_TYPE_HTTP_REQUEST
,
46 typedef struct _WININETHANDLEHEADER
52 struct _WININETHANDLEHEADER
*lpwhparent
;
53 } WININETHANDLEHEADER
, *LPWININETHANDLEHEADER
;
58 WININETHANDLEHEADER hdr
;
61 LPSTR lpszProxyBypass
;
63 INTERNET_STATUS_CALLBACK lpfnStatusCB
;
64 } WININETAPPINFOA
, *LPWININETAPPINFOA
;
69 WININETHANDLEHEADER hdr
;
72 INTERNET_PORT nServerPort
;
73 struct sockaddr_in socketAddress
;
74 struct hostent
*phostent
;
75 } WININETHTTPSESSIONA
, *LPWININETHTTPSESSIONA
;
77 #define HDR_ISREQUEST 0x0001
78 #define HDR_COMMADELIMITED 0x0002
79 #define HDR_SEMIDELIMITED 0x0004
87 } HTTPHEADERA
, *LPHTTPHEADERA
;
92 WININETHANDLEHEADER hdr
;
97 HTTPHEADERA StdHeaders
[HTTP_QUERY_MAX
+1];
98 HTTPHEADERA
*pCustHeaders
;
100 } WININETHTTPREQA
, *LPWININETHTTPREQA
;
105 WININETHANDLEHEADER hdr
;
108 int pasvSocket
; /* data socket connected by us in case of passive FTP */
109 struct sockaddr_in socketAddress
;
110 struct sockaddr_in lstnSocketAddress
;
111 struct hostent
*phostent
;
114 } WININETFTPSESSIONA
, *LPWININETFTPSESSIONA
;
119 WININETHANDLEHEADER hdr
;
121 } WININETFILE
, *LPWININETFILE
;
129 struct tm tmLastModified
;
130 unsigned short permissions
;
131 } FILEPROPERTIESA
, *LPFILEPROPERTIESA
;
136 WININETHANDLEHEADER hdr
;
139 LPFILEPROPERTIESA lpafp
;
140 } WININETFINDNEXTA
, *LPWININETFINDNEXTA
;
145 FTPSETCURRENTDIRECTORYA
,
148 FTPGETCURRENTDIRECTORYA
,
160 typedef struct WORKREQ
164 #define HFTPSESSION param1
167 #define LPSZLOCALFILE param2
168 #define LPSZREMOTEFILE param2
169 #define LPSZFILENAME param2
170 #define LPSZSRCFILE param2
171 #define LPSZDIRECTORY param2
172 #define LPSZSEARCHFILE param2
173 #define LPSZHEADER param2
174 #define LPSZVERB param2
177 #define LPSZNEWREMOTEFILE param3
178 #define LPSZNEWFILE param3
179 #define LPFINDFILEDATA param3
180 #define LPDWDIRECTORY param3
181 #define FDWACCESS param3
182 #define LPSZDESTFILE param3
183 #define DWHEADERLENGTH param3
184 #define LPSZOBJECTNAME param3
187 #define DWFLAGS param4
188 #define LPOPTIONAL param4
191 #define DWCONTEXT param5
192 #define DWOPTIONALLENGTH param5
195 #define FFAILIFEXISTS param6
196 #define LPSZVERSION param6
199 #define DWLOCALFLAGSATTRIBUTE param7
200 #define LPSZREFERRER param7
203 #define LPSZACCEPTTYPES param8
205 struct WORKREQ
*next
;
206 struct WORKREQ
*prev
;
208 } WORKREQUEST
, *LPWORKREQUEST
;
211 time_t ConvertTimeString(LPCSTR asctime
);
213 HINTERNET
FTP_Connect(HINTERNET hInterent
, LPCSTR lpszServerName
,
214 INTERNET_PORT nServerPort
, LPCSTR lpszUserName
,
215 LPCSTR lpszPassword
, DWORD dwFlags
, DWORD dwContext
);
217 HINTERNET
HTTP_Connect(HINTERNET hInterent
, LPCSTR lpszServerName
,
218 INTERNET_PORT nServerPort
, LPCSTR lpszUserName
,
219 LPCSTR lpszPassword
, DWORD dwFlags
, DWORD dwContext
);
221 BOOL
GetAddress(LPCSTR lpszServerName
, INTERNET_PORT nServerPort
,
222 struct hostent
**phe
, struct sockaddr_in
*psa
);
224 void INTERNET_SetLastError(DWORD dwError
);
225 DWORD
INTERNET_GetLastError();
226 BOOL
INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest
);
227 LPSTR
INTERNET_GetResponseBuffer();
228 LPSTR
INTERNET_GetNextLine(INT nSocket
, LPSTR lpszBuffer
, LPDWORD dwBuffer
);
230 BOOL
FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs
);
231 BOOL
FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn
);
232 BOOLAPI
FTP_FtpPutFileA(HINTERNET hConnect
, LPCSTR lpszLocalFile
,
233 LPCSTR lpszNewRemoteFile
, DWORD dwFlags
, DWORD dwContext
);
234 BOOLAPI
FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect
, LPCSTR lpszDirectory
);
235 BOOLAPI
FTP_FtpCreateDirectoryA(HINTERNET hConnect
, LPCSTR lpszDirectory
);
236 INTERNETAPI HINTERNET WINAPI
FTP_FtpFindFirstFileA(HINTERNET hConnect
,
237 LPCSTR lpszSearchFile
, LPWIN32_FIND_DATAA lpFindFileData
, DWORD dwFlags
, DWORD dwContext
);
238 BOOLAPI
FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession
, LPSTR lpszCurrentDirectory
,
239 LPDWORD lpdwCurrentDirectory
);
240 BOOL
FTP_ConvertFileProp(LPFILEPROPERTIESA lpafp
, LPWIN32_FIND_DATAA lpFindFileData
);
241 BOOL
FTP_FtpRenameFileA(HINTERNET hFtpSession
, LPCSTR lpszSrc
, LPCSTR lpszDest
);
242 BOOL
FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession
, LPCSTR lpszDirectory
);
243 BOOL
FTP_FtpDeleteFileA(HINTERNET hFtpSession
, LPCSTR lpszFileName
);
244 HINTERNET
FTP_FtpOpenFileA(HINTERNET hFtpSession
, LPCSTR lpszFileName
,
245 DWORD fdwAccess
, DWORD dwFlags
, DWORD dwContext
);
246 BOOLAPI
FTP_FtpGetFileA(HINTERNET hInternet
, LPCSTR lpszRemoteFile
, LPCSTR lpszNewFile
,
247 BOOL fFailIfExists
, DWORD dwLocalFlagsAttribute
, DWORD dwInternetFlags
,
250 BOOLAPI
HTTP_HttpSendRequestA(HINTERNET hHttpRequest
, LPCSTR lpszHeaders
,
251 DWORD dwHeaderLength
, LPVOID lpOptional
,DWORD dwOptionalLength
);
252 INTERNETAPI HINTERNET WINAPI
HTTP_HttpOpenRequestA(HINTERNET hHttpSession
,
253 LPCSTR lpszVerb
, LPCSTR lpszObjectName
, LPCSTR lpszVersion
,
254 LPCSTR lpszReferrer
, LPCSTR
*lpszAcceptTypes
,
255 DWORD dwFlags
, DWORD dwContext
);
256 void HTTP_CloseHTTPSessionHandle(LPWININETHTTPSESSIONA lpwhs
);
257 void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr
);
259 VOID
SendAsyncCallback(LPWININETAPPINFOA hIC
, HINTERNET hHttpSession
,
260 DWORD dwContext
, DWORD dwInternetStatus
, LPVOID
261 lpvStatusInfo
, DWORD dwStatusInfoLength
);
263 VOID
SendAsyncCallbackInt(LPWININETAPPINFOA hIC
, HINTERNET hHttpSession
,
264 DWORD dwContext
, DWORD dwInternetStatus
, LPVOID
265 lpvStatusInfo
, DWORD dwStatusInfoLength
);
268 #define MAX_REPLY_LEN 0x5B4
271 #endif /* _WINE_INTERNET_H_ */