Framework for the doppler effect.
[wine] / dlls / wininet / internet.h
1 /*
2  * Wininet
3  *
4  * Copyright 1999 Corel Corporation
5  *
6  * Ulrich Czekalla
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef _WINE_INTERNET_H_
24 #define _WINE_INTERNET_H_
25
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
35 typedef enum
36 {
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,
44 } WH_TYPE;
45
46 typedef struct _WININETHANDLEHEADER
47 {
48     WH_TYPE htype;
49     DWORD  dwFlags;
50     DWORD  dwContext;
51     DWORD  dwError;
52     struct _WININETHANDLEHEADER *lpwhparent;
53 } WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
54
55
56 typedef struct
57 {
58     WININETHANDLEHEADER hdr;
59     LPSTR  lpszAgent;
60     LPSTR  lpszProxy;
61     LPSTR  lpszProxyBypass;
62     DWORD   dwAccessType;
63     INTERNET_STATUS_CALLBACK lpfnStatusCB;
64 } WININETAPPINFOA, *LPWININETAPPINFOA;
65
66
67 typedef struct
68 {
69     WININETHANDLEHEADER hdr;
70     LPSTR  lpszServerName;
71     LPSTR  lpszUserName;
72     INTERNET_PORT nServerPort;
73     struct sockaddr_in socketAddress;
74     struct hostent *phostent;
75 } WININETHTTPSESSIONA, *LPWININETHTTPSESSIONA;
76
77 #define HDR_ISREQUEST           0x0001
78 #define HDR_COMMADELIMITED      0x0002
79 #define HDR_SEMIDELIMITED       0x0004
80
81 typedef struct
82 {
83     LPSTR lpszField;
84     LPSTR lpszValue;
85     WORD wFlags;
86     WORD wCount;
87 } HTTPHEADERA, *LPHTTPHEADERA;
88
89
90 typedef struct
91 {
92     WININETHANDLEHEADER hdr;
93     LPSTR lpszPath;
94     LPSTR lpszVerb;
95     LPSTR lpszHostName;
96     INT nSocketFD;
97     HTTPHEADERA StdHeaders[HTTP_QUERY_MAX+1];
98     HTTPHEADERA *pCustHeaders;
99     INT nCustHeaders;
100 } WININETHTTPREQA, *LPWININETHTTPREQA;
101
102
103 typedef struct
104 {
105     WININETHANDLEHEADER hdr;
106     int sndSocket;
107     int lstnSocket;
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;
112     LPSTR  lpszPassword;
113     LPSTR  lpszUserName;
114 } WININETFTPSESSIONA, *LPWININETFTPSESSIONA;
115
116
117 typedef struct
118 {
119     WININETHANDLEHEADER hdr;
120     int nDataSocket;
121 } WININETFILE, *LPWININETFILE;
122
123
124 typedef struct
125 {
126     BOOL bIsDirectory;
127     LPSTR lpszName;
128     DWORD nSize;
129     struct tm tmLastModified;
130     unsigned short permissions;
131 } FILEPROPERTIESA, *LPFILEPROPERTIESA;
132
133
134 typedef struct
135 {
136     WININETHANDLEHEADER hdr;
137     int index;
138     DWORD size;
139     LPFILEPROPERTIESA lpafp;
140 } WININETFINDNEXTA, *LPWININETFINDNEXTA;
141
142 typedef enum
143 {
144     FTPPUTFILEA,
145     FTPSETCURRENTDIRECTORYA,
146     FTPCREATEDIRECTORYA,
147     FTPFINDFIRSTFILEA,
148     FTPGETCURRENTDIRECTORYA,
149     FTPOPENFILEA,
150     FTPGETFILEA,
151     FTPDELETEFILEA,
152     FTPREMOVEDIRECTORYA,
153     FTPRENAMEFILEA,
154     INTERNETFINDNEXTA,
155     HTTPSENDREQUESTA,
156     HTTPOPENREQUESTA,
157     SENDCALLBACK,
158 } ASYNC_FUNC;
159
160 typedef struct WORKREQ
161 {
162     ASYNC_FUNC asyncall;
163     DWORD param1;
164 #define HFTPSESSION       param1
165
166     DWORD param2;
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
175
176     DWORD param3;
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
185
186     DWORD param4;
187 #define DWFLAGS           param4
188 #define LPOPTIONAL        param4
189
190     DWORD param5;
191 #define DWCONTEXT         param5
192 #define DWOPTIONALLENGTH  param5
193
194     DWORD param6;
195 #define FFAILIFEXISTS     param6
196 #define LPSZVERSION       param6
197
198     DWORD param7;
199 #define DWLOCALFLAGSATTRIBUTE param7
200 #define LPSZREFERRER          param7
201
202     DWORD param8;
203 #define LPSZACCEPTTYPES       param8
204
205     struct WORKREQ *next;
206     struct WORKREQ *prev;
207
208 } WORKREQUEST, *LPWORKREQUEST;
209
210
211 time_t ConvertTimeString(LPCSTR asctime);
212
213 HINTERNET FTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
214         INTERNET_PORT nServerPort, LPCSTR lpszUserName,
215         LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
216
217 HINTERNET HTTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
218         INTERNET_PORT nServerPort, LPCSTR lpszUserName,
219         LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
220
221 BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
222         struct hostent **phe, struct sockaddr_in *psa);
223
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);
229
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,
248         DWORD dwContext);
249
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);
258
259 VOID SendAsyncCallback(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
260                              DWORD dwContext, DWORD dwInternetStatus, LPVOID
261                              lpvStatusInfo , DWORD dwStatusInfoLength);
262
263 VOID SendAsyncCallbackInt(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
264                              DWORD dwContext, DWORD dwInternetStatus, LPVOID
265                              lpvStatusInfo , DWORD dwStatusInfoLength);
266
267
268 #define MAX_REPLY_LEN           0x5B4
269
270
271 #endif /* _WINE_INTERNET_H_ */