~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/wininet/internet.h

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 21  */
 22 
 23 #ifndef _WINE_INTERNET_H_
 24 #define _WINE_INTERNET_H_
 25 
 26 #ifndef __WINE_CONFIG_H
 27 # error You must include config.h to use this header
 28 #endif
 29 
 30 #include "wine/unicode.h"
 31 #include "wine/list.h"
 32 
 33 #include <time.h>
 34 #ifdef HAVE_NETDB_H
 35 # include <netdb.h>
 36 #endif
 37 #ifdef HAVE_NETINET_IN_H
 38 # include <sys/types.h>
 39 # include <netinet/in.h>
 40 #endif
 41 #ifdef HAVE_SYS_SOCKET_H
 42 # include <sys/socket.h>
 43 #endif
 44 
 45 #if defined(__MINGW32__) || defined (_MSC_VER)
 46 #include "ws2tcpip.h"
 47 #ifndef MSG_WAITALL
 48 #define MSG_WAITALL 0
 49 #endif
 50 #else
 51 #define closesocket close
 52 #define ioctlsocket ioctl
 53 #endif /* __MINGW32__ */
 54 
 55 /* used for netconnection.c stuff */
 56 typedef struct
 57 {
 58     BOOL useSSL;
 59     int socketFD;
 60     void *ssl_s;
 61     char *peek_msg;
 62     char *peek_msg_mem;
 63     size_t peek_len;
 64 } WININET_NETCONNECTION;
 65 
 66 static inline LPWSTR WININET_strdupW( LPCWSTR str )
 67 {
 68     LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1)*sizeof(WCHAR) );
 69     if (ret) strcpyW( ret, str );
 70     return ret;
 71 }
 72 
 73 static inline LPWSTR WININET_strdup_AtoW( LPCSTR str )
 74 {
 75     int len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0);
 76     LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
 77     if (ret)
 78         MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len);
 79     return ret;
 80 }
 81 
 82 static inline LPSTR WININET_strdup_WtoA( LPCWSTR str )
 83 {
 84     int len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
 85     LPSTR ret = HeapAlloc( GetProcessHeap(), 0, len );
 86     if (ret)
 87         WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL);
 88     return ret;
 89 }
 90 
 91 static inline void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
 92 {
 93     dataA->dwFileAttributes = dataW->dwFileAttributes;
 94     dataA->ftCreationTime   = dataW->ftCreationTime;
 95     dataA->ftLastAccessTime = dataW->ftLastAccessTime;
 96     dataA->ftLastWriteTime  = dataW->ftLastWriteTime;
 97     dataA->nFileSizeHigh    = dataW->nFileSizeHigh;
 98     dataA->nFileSizeLow     = dataW->nFileSizeLow;
 99     dataA->dwReserved0      = dataW->dwReserved0;
100     dataA->dwReserved1      = dataW->dwReserved1;
101     WideCharToMultiByte(CP_ACP, 0, dataW->cFileName, -1, 
102         dataA->cFileName, sizeof(dataA->cFileName),
103         NULL, NULL);
104     WideCharToMultiByte(CP_ACP, 0, dataW->cAlternateFileName, -1, 
105         dataA->cAlternateFileName, sizeof(dataA->cAlternateFileName),
106         NULL, NULL);
107 }
108 
109 typedef enum
110 {
111     WH_HINIT = INTERNET_HANDLE_TYPE_INTERNET,
112     WH_HFTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_FTP,
113     WH_HGOPHERSESSION = INTERNET_HANDLE_TYPE_CONNECT_GOPHER,
114     WH_HHTTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_HTTP,
115     WH_HFILE = INTERNET_HANDLE_TYPE_FTP_FILE,
116     WH_HFTPFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND,
117     WH_HHTTPREQ = INTERNET_HANDLE_TYPE_HTTP_REQUEST,
118 } WH_TYPE;
119 
120 #define INET_OPENURL 0x0001
121 #define INET_CALLBACKW 0x0002
122 
123 typedef struct _WININETHANDLEHEADER WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
124 
125 typedef struct {
126     void (*Destroy)(WININETHANDLEHEADER*);
127     void (*CloseConnection)(WININETHANDLEHEADER*);
128     DWORD (*QueryOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD*,BOOL);
129     DWORD (*SetOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD);
130     DWORD (*ReadFile)(WININETHANDLEHEADER*,void*,DWORD,DWORD*);
131     DWORD (*ReadFileExA)(WININETHANDLEHEADER*,INTERNET_BUFFERSA*,DWORD,DWORD_PTR);
132     BOOL (*WriteFile)(WININETHANDLEHEADER*,const void*,DWORD,DWORD*);
133     DWORD (*QueryDataAvailable)(WININETHANDLEHEADER*,DWORD*,DWORD,DWORD_PTR);
134     DWORD (*FindNextFileW)(WININETHANDLEHEADER*,void*);
135 } HANDLEHEADERVtbl;
136 
137 struct _WININETHANDLEHEADER
138 {
139     WH_TYPE htype;
140     const HANDLEHEADERVtbl *vtbl;
141     HINTERNET hInternet;
142     DWORD  dwFlags;
143     DWORD_PTR dwContext;
144     DWORD  dwError;
145     DWORD  dwInternalFlags;
146     LONG   refs;
147     INTERNET_STATUS_CALLBACK lpfnStatusCB;
148     struct list entry;
149     struct list children;
150 };
151 
152 
153 typedef struct
154 {
155     WININETHANDLEHEADER hdr;
156     LPWSTR  lpszAgent;
157     LPWSTR  lpszProxy;
158     LPWSTR  lpszProxyBypass;
159     LPWSTR  lpszProxyUsername;
160     LPWSTR  lpszProxyPassword;
161     DWORD   dwAccessType;
162 } WININETAPPINFOW, *LPWININETAPPINFOW;
163 
164 
165 typedef struct
166 {
167     WININETHANDLEHEADER hdr;
168     WININETAPPINFOW *lpAppInfo;
169     LPWSTR  lpszHostName; /* the final destination of the request */
170     LPWSTR  lpszServerName; /* the name of the server we directly connect to */
171     LPWSTR  lpszUserName;
172     LPWSTR  lpszPassword;
173     INTERNET_PORT nHostPort; /* the final destination port of the request */
174     INTERNET_PORT nServerPort; /* the port of the server we directly connect to */
175     struct sockaddr_in socketAddress;
176 } WININETHTTPSESSIONW, *LPWININETHTTPSESSIONW;
177 
178 #define HDR_ISREQUEST           0x0001
179 #define HDR_COMMADELIMITED      0x0002
180 #define HDR_SEMIDELIMITED       0x0004
181 
182 typedef struct
183 {
184     LPWSTR lpszField;
185     LPWSTR lpszValue;
186     WORD wFlags;
187     WORD wCount;
188 } HTTPHEADERW, *LPHTTPHEADERW;
189 
190 
191 struct HttpAuthInfo;
192 
193 typedef struct
194 {
195     WININETHANDLEHEADER hdr;
196     WININETHTTPSESSIONW *lpHttpSession;
197     LPWSTR lpszPath;
198     LPWSTR lpszVerb;
199     LPWSTR lpszRawHeaders;
200     WININET_NETCONNECTION netConnection;
201     LPWSTR lpszVersion;
202     LPWSTR lpszStatusText;
203     DWORD dwContentLength; /* total number of bytes to be read */
204     DWORD dwContentRead; /* bytes of the content read so far */
205     HTTPHEADERW *pCustHeaders;
206     DWORD nCustHeaders;
207     HANDLE hCacheFile;
208     LPWSTR lpszCacheFile;
209     struct HttpAuthInfo *pAuthInfo;
210     struct HttpAuthInfo *pProxyAuthInfo;
211 } WININETHTTPREQW, *LPWININETHTTPREQW;
212 
213 
214 
215 struct WORKREQ_FTPPUTFILEW
216 {
217     LPWSTR lpszLocalFile;
218     LPWSTR lpszNewRemoteFile;
219     DWORD  dwFlags;
220     DWORD_PTR dwContext;
221 };
222 
223 struct WORKREQ_FTPSETCURRENTDIRECTORYW
224 {
225     LPWSTR lpszDirectory;
226 };
227 
228 struct WORKREQ_FTPCREATEDIRECTORYW
229 {
230     LPWSTR lpszDirectory;
231 };
232 
233 struct WORKREQ_FTPFINDFIRSTFILEW
234 {
235     LPWSTR lpszSearchFile;
236     LPWIN32_FIND_DATAW lpFindFileData;
237     DWORD  dwFlags;
238     DWORD_PTR dwContext;
239 };
240 
241 struct WORKREQ_FTPGETCURRENTDIRECTORYW
242 {
243     LPWSTR lpszDirectory;
244     DWORD *lpdwDirectory;
245 };
246 
247 struct WORKREQ_FTPOPENFILEW
248 {
249     LPWSTR lpszFilename;
250     DWORD  dwAccess;
251     DWORD  dwFlags;
252     DWORD_PTR dwContext;
253 };
254 
255 struct WORKREQ_FTPGETFILEW
256 {
257     LPWSTR lpszRemoteFile;
258     LPWSTR lpszNewFile;
259     BOOL   fFailIfExists;
260     DWORD  dwLocalFlagsAttribute;
261     DWORD  dwFlags;
262     DWORD_PTR dwContext;
263 };
264 
265 struct WORKREQ_FTPDELETEFILEW
266 {
267     LPWSTR lpszFilename;
268 };
269 
270 struct WORKREQ_FTPREMOVEDIRECTORYW
271 {
272     LPWSTR lpszDirectory;
273 };
274 
275 struct WORKREQ_FTPRENAMEFILEW
276 {
277     LPWSTR lpszSrcFile;
278     LPWSTR lpszDestFile;
279 };
280 
281 struct WORKREQ_FTPFINDNEXTW
282 {
283     LPWIN32_FIND_DATAW lpFindFileData;
284 };
285 
286 struct WORKREQ_HTTPSENDREQUESTW
287 {
288     LPWSTR lpszHeader;
289     DWORD  dwHeaderLength;
290     LPVOID lpOptional;
291     DWORD  dwOptionalLength;
292     DWORD  dwContentLength;
293     BOOL   bEndRequest;
294 };
295 
296 struct WORKREQ_SENDCALLBACK
297 {
298     DWORD_PTR dwContext;
299     DWORD     dwInternetStatus;
300     LPVOID    lpvStatusInfo;
301     DWORD     dwStatusInfoLength;
302 };
303 
304 struct WORKREQ_INTERNETOPENURLW
305 {
306     HINTERNET hInternet;
307     LPWSTR     lpszUrl;
308     LPWSTR     lpszHeaders;
309     DWORD     dwHeadersLength;
310     DWORD     dwFlags;
311     DWORD_PTR dwContext;
312 };
313 
314 struct WORKREQ_INTERNETREADFILEEXA
315 {
316     LPINTERNET_BUFFERSA lpBuffersOut;
317 };
318 
319 typedef struct WORKREQ
320 {
321     void (*asyncproc)(struct WORKREQ*);
322     WININETHANDLEHEADER *hdr;
323 
324     union {
325         struct WORKREQ_FTPPUTFILEW              FtpPutFileW;
326         struct WORKREQ_FTPSETCURRENTDIRECTORYW  FtpSetCurrentDirectoryW;
327         struct WORKREQ_FTPCREATEDIRECTORYW      FtpCreateDirectoryW;
328         struct WORKREQ_FTPFINDFIRSTFILEW        FtpFindFirstFileW;
329         struct WORKREQ_FTPGETCURRENTDIRECTORYW  FtpGetCurrentDirectoryW;
330         struct WORKREQ_FTPOPENFILEW             FtpOpenFileW;
331         struct WORKREQ_FTPGETFILEW              FtpGetFileW;
332         struct WORKREQ_FTPDELETEFILEW           FtpDeleteFileW;
333         struct WORKREQ_FTPREMOVEDIRECTORYW      FtpRemoveDirectoryW;
334         struct WORKREQ_FTPRENAMEFILEW           FtpRenameFileW;
335         struct WORKREQ_FTPFINDNEXTW             FtpFindNextW;
336         struct WORKREQ_HTTPSENDREQUESTW         HttpSendRequestW;
337         struct WORKREQ_SENDCALLBACK             SendCallback;
338         struct WORKREQ_INTERNETOPENURLW         InternetOpenUrlW;
339         struct WORKREQ_INTERNETREADFILEEXA      InternetReadFileExA;
340     } u;
341 
342 } WORKREQUEST, *LPWORKREQUEST;
343 
344 HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info );
345 LPWININETHANDLEHEADER WININET_GetObject( HINTERNET hinternet );
346 LPWININETHANDLEHEADER WININET_AddRef( LPWININETHANDLEHEADER info );
347 BOOL WININET_Release( LPWININETHANDLEHEADER info );
348 BOOL WININET_FreeHandle( HINTERNET hinternet );
349 
350 time_t ConvertTimeString(LPCWSTR asctime);
351 
352 HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
353         INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
354         LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext,
355         DWORD dwInternalFlags);
356 
357 HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
358         INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
359         LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext,
360         DWORD dwInternalFlags);
361 
362 BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
363         struct sockaddr_in *psa);
364 
365 void INTERNET_SetLastError(DWORD dwError);
366 DWORD INTERNET_GetLastError(void);
367 BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
368 LPSTR INTERNET_GetResponseBuffer(void);
369 LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen);
370 
371 BOOLAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
372         DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength,
373         DWORD dwContentLength, BOOL bEndRequest);
374 INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
375         LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion,
376         LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes,
377         DWORD dwFlags, DWORD_PTR dwContext);
378 BOOL HTTP_FinishedReading(LPWININETHTTPREQW lpwhr);
379 
380 VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD_PTR dwContext,
381                        DWORD dwInternetStatus, LPVOID lpvStatusInfo,
382                        DWORD dwStatusInfoLength);
383 
384 VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD_PTR dwContext,
385                            DWORD dwInternetStatus, LPVOID lpvStatusInfo,
386                            DWORD dwStatusInfoLength);
387 
388 LPHTTPHEADERW HTTP_GetHeader(LPWININETHTTPREQW lpwhr, LPCWSTR header);
389 
390 BOOL NETCON_connected(WININET_NETCONNECTION *connection);
391 BOOL NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL);
392 BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
393               int type, int protocol);
394 BOOL NETCON_close(WININET_NETCONNECTION *connection);
395 BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
396                     unsigned int addrlen);
397 BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname);
398 BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags,
399                 int *sent /* out */);
400 BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
401                 int *recvd /* out */);
402 BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available);
403 BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPDWORD dwBuffer);
404 LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection);
405 DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value);
406 
407 extern void URLCacheContainers_CreateDefaults(void);
408 extern void URLCacheContainers_DeleteAll(void);
409 
410 #define MAX_REPLY_LEN           0x5B4
411 
412 /* Used for debugging - maybe need to be shared in the Wine debugging code ? */
413 typedef struct
414 {
415     DWORD val;
416     const char* name;
417 } wininet_flag_info;
418 
419 #endif /* _WINE_INTERNET_H_ */
420 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.