*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _WINE_INTERNET_H_
#define _WINE_INTERNET_H_
+#ifndef __WINE_CONFIG_H
+# error You must include config.h to use this header
+#endif
+
#include "wine/unicode.h"
+#include "wine/list.h"
#include <time.h>
#ifdef HAVE_NETDB_H
# include <sys/types.h>
# include <netinet/in.h>
#endif
-#ifdef HAVE_OPENSSL_SSL_H
-#define DSA __ssl_DSA /* avoid conflict with commctrl.h */
-#undef FAR
-# include <openssl/ssl.h>
-#undef FAR
-#define FAR do_not_use_this_in_wine
-#undef DSA
-#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if defined(__MINGW32__) || defined (_MSC_VER)
-#include "winsock2.h"
#ifndef MSG_WAITALL
#define MSG_WAITALL 0
#endif
#else
#define closesocket close
+#define ioctlsocket ioctl
#endif /* __MINGW32__ */
/* used for netconnection.c stuff */
{
BOOL useSSL;
int socketFD;
-#ifdef HAVE_OPENSSL_SSL_H
- SSL *ssl_s;
+ void *ssl_s;
char *peek_msg;
char *peek_msg_mem;
-#endif
+ size_t peek_len;
} WININET_NETCONNECTION;
-inline static LPSTR WININET_strdup( LPCSTR str )
-{
- LPSTR ret = HeapAlloc( GetProcessHeap(), 0, strlen(str) + 1 );
- if (ret) strcpy( ret, str );
- return ret;
-}
-
-inline static LPWSTR WININET_strdupW( LPCWSTR str )
+static inline LPWSTR WININET_strdupW( LPCWSTR str )
{
LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1)*sizeof(WCHAR) );
if (ret) strcpyW( ret, str );
return ret;
}
-inline static LPWSTR WININET_strdup_AtoW( LPCSTR str )
+static inline LPWSTR WININET_strdup_AtoW( LPCSTR str )
{
int len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0);
LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
return ret;
}
-inline static LPSTR WININET_strdup_WtoA( LPCWSTR str )
+static inline LPSTR WININET_strdup_WtoA( LPCWSTR str )
{
int len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
LPSTR ret = HeapAlloc( GetProcessHeap(), 0, len );
return ret;
}
-inline static void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
+static inline void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
{
dataA->dwFileAttributes = dataW->dwFileAttributes;
dataA->ftCreationTime = dataW->ftCreationTime;
WH_HGOPHERSESSION = INTERNET_HANDLE_TYPE_CONNECT_GOPHER,
WH_HHTTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_HTTP,
WH_HFILE = INTERNET_HANDLE_TYPE_FTP_FILE,
- WH_HFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND,
+ WH_HFTPFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND,
WH_HHTTPREQ = INTERNET_HANDLE_TYPE_HTTP_REQUEST,
} WH_TYPE;
#define INET_OPENURL 0x0001
#define INET_CALLBACKW 0x0002
-struct _WININETHANDLEHEADER;
typedef struct _WININETHANDLEHEADER WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
-typedef void (*WININET_object_destructor)( LPWININETHANDLEHEADER );
+typedef struct {
+ void (*Destroy)(WININETHANDLEHEADER*);
+ void (*CloseConnection)(WININETHANDLEHEADER*);
+ DWORD (*QueryOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD*,BOOL);
+ DWORD (*SetOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD);
+ DWORD (*ReadFile)(WININETHANDLEHEADER*,void*,DWORD,DWORD*);
+ DWORD (*ReadFileExA)(WININETHANDLEHEADER*,INTERNET_BUFFERSA*,DWORD,DWORD_PTR);
+ BOOL (*WriteFile)(WININETHANDLEHEADER*,const void*,DWORD,DWORD*);
+ DWORD (*QueryDataAvailable)(WININETHANDLEHEADER*,DWORD*,DWORD,DWORD_PTR);
+ DWORD (*FindNextFileW)(WININETHANDLEHEADER*,void*);
+} HANDLEHEADERVtbl;
struct _WININETHANDLEHEADER
{
WH_TYPE htype;
+ const HANDLEHEADERVtbl *vtbl;
+ HINTERNET hInternet;
DWORD dwFlags;
- DWORD dwContext;
+ DWORD_PTR dwContext;
DWORD dwError;
DWORD dwInternalFlags;
- DWORD dwRefCount;
- WININET_object_destructor destroy;
+ LONG refs;
INTERNET_STATUS_CALLBACK lpfnStatusCB;
- struct _WININETHANDLEHEADER *lpwhparent;
+ struct list entry;
+ struct list children;
};
typedef struct
{
WININETHANDLEHEADER hdr;
+ WININETAPPINFOW *lpAppInfo;
LPWSTR lpszHostName; /* the final destination of the request */
LPWSTR lpszServerName; /* the name of the server we directly connect to */
LPWSTR lpszUserName;
+ LPWSTR lpszPassword;
INTERNET_PORT nHostPort; /* the final destination port of the request */
INTERNET_PORT nServerPort; /* the port of the server we directly connect to */
struct sockaddr_in socketAddress;
} HTTPHEADERW, *LPHTTPHEADERW;
+struct HttpAuthInfo;
+
typedef struct
{
WININETHANDLEHEADER hdr;
+ WININETHTTPSESSIONW *lpHttpSession;
LPWSTR lpszPath;
LPWSTR lpszVerb;
LPWSTR lpszRawHeaders;
WININET_NETCONNECTION netConnection;
LPWSTR lpszVersion;
LPWSTR lpszStatusText;
+ DWORD dwContentLength; /* total number of bytes to be read */
+ DWORD dwContentRead; /* bytes of the content read so far */
HTTPHEADERW *pCustHeaders;
DWORD nCustHeaders;
+ HANDLE hCacheFile;
+ LPWSTR lpszCacheFile;
+ struct HttpAuthInfo *pAuthInfo;
+ struct HttpAuthInfo *pProxyAuthInfo;
} WININETHTTPREQW, *LPWININETHTTPREQW;
-typedef struct
-{
- WININETHANDLEHEADER hdr;
- BOOL session_deleted;
- int nDataSocket;
-} WININETFILE, *LPWININETFILE;
-
-
-typedef struct
-{
- WININETHANDLEHEADER hdr;
- int sndSocket;
- int lstnSocket;
- int pasvSocket; /* data socket connected by us in case of passive FTP */
- LPWININETFILE download_in_progress;
- struct sockaddr_in socketAddress;
- struct sockaddr_in lstnSocketAddress;
- LPWSTR lpszPassword;
- LPWSTR lpszUserName;
-} WININETFTPSESSIONW, *LPWININETFTPSESSIONW;
-
-
-typedef struct
-{
- BOOL bIsDirectory;
- LPWSTR lpszName;
- DWORD nSize;
- struct tm tmLastModified;
- unsigned short permissions;
-} FILEPROPERTIESW, *LPFILEPROPERTIESW;
-
-
-typedef struct
-{
- WININETHANDLEHEADER hdr;
- DWORD index;
- DWORD size;
- LPFILEPROPERTIESW lpafp;
-} WININETFINDNEXTW, *LPWININETFINDNEXTW;
-
-typedef enum
-{
- FTPPUTFILEW,
- FTPSETCURRENTDIRECTORYW,
- FTPCREATEDIRECTORYW,
- FTPFINDFIRSTFILEW,
- FTPGETCURRENTDIRECTORYW,
- FTPOPENFILEW,
- FTPGETFILEW,
- FTPDELETEFILEW,
- FTPREMOVEDIRECTORYW,
- FTPRENAMEFILEW,
- INTERNETFINDNEXTW,
- HTTPSENDREQUESTW,
- HTTPOPENREQUESTW,
- SENDCALLBACK,
- INTERNETOPENURLW,
- INTERNETREADFILEEXA,
-} ASYNC_FUNC;
struct WORKREQ_FTPPUTFILEW
{
LPWSTR lpszLocalFile;
LPWSTR lpszNewRemoteFile;
DWORD dwFlags;
- DWORD dwContext;
+ DWORD_PTR dwContext;
};
struct WORKREQ_FTPSETCURRENTDIRECTORYW
LPWSTR lpszSearchFile;
LPWIN32_FIND_DATAW lpFindFileData;
DWORD dwFlags;
- DWORD dwContext;
+ DWORD_PTR dwContext;
};
struct WORKREQ_FTPGETCURRENTDIRECTORYW
LPWSTR lpszFilename;
DWORD dwAccess;
DWORD dwFlags;
- DWORD dwContext;
+ DWORD_PTR dwContext;
};
struct WORKREQ_FTPGETFILEW
BOOL fFailIfExists;
DWORD dwLocalFlagsAttribute;
DWORD dwFlags;
- DWORD dwContext;
+ DWORD_PTR dwContext;
};
struct WORKREQ_FTPDELETEFILEW
LPWSTR lpszDestFile;
};
-struct WORKREQ_INTERNETFINDNEXTW
+struct WORKREQ_FTPFINDNEXTW
{
LPWIN32_FIND_DATAW lpFindFileData;
};
-struct WORKREQ_HTTPOPENREQUESTW
-{
- LPWSTR lpszVerb;
- LPWSTR lpszObjectName;
- LPWSTR lpszVersion;
- LPWSTR lpszReferrer;
- LPCWSTR *lpszAcceptTypes;
- DWORD dwFlags;
- DWORD dwContext;
-};
-
struct WORKREQ_HTTPSENDREQUESTW
{
LPWSTR lpszHeader;
struct WORKREQ_SENDCALLBACK
{
- DWORD dwContext;
+ DWORD_PTR dwContext;
DWORD dwInternetStatus;
LPVOID lpvStatusInfo;
DWORD dwStatusInfoLength;
LPWSTR lpszHeaders;
DWORD dwHeadersLength;
DWORD dwFlags;
- DWORD dwContext;
+ DWORD_PTR dwContext;
};
struct WORKREQ_INTERNETREADFILEEXA
typedef struct WORKREQ
{
- ASYNC_FUNC asyncall;
+ void (*asyncproc)(struct WORKREQ*);
WININETHANDLEHEADER *hdr;
union {
struct WORKREQ_FTPDELETEFILEW FtpDeleteFileW;
struct WORKREQ_FTPREMOVEDIRECTORYW FtpRemoveDirectoryW;
struct WORKREQ_FTPRENAMEFILEW FtpRenameFileW;
- struct WORKREQ_INTERNETFINDNEXTW InternetFindNextW;
- struct WORKREQ_HTTPOPENREQUESTW HttpOpenRequestW;
+ struct WORKREQ_FTPFINDNEXTW FtpFindNextW;
struct WORKREQ_HTTPSENDREQUESTW HttpSendRequestW;
struct WORKREQ_SENDCALLBACK SendCallback;
struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;
struct WORKREQ_INTERNETREADFILEEXA InternetReadFileExA;
} u;
- struct WORKREQ *next;
- struct WORKREQ *prev;
-
} WORKREQUEST, *LPWORKREQUEST;
HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info );
LPWININETHANDLEHEADER WININET_AddRef( LPWININETHANDLEHEADER info );
BOOL WININET_Release( LPWININETHANDLEHEADER info );
BOOL WININET_FreeHandle( HINTERNET hinternet );
-HINTERNET WININET_FindHandle( LPWININETHANDLEHEADER info );
+
+DWORD INET_QueryOption(DWORD,void*,DWORD*,BOOL);
time_t ConvertTimeString(LPCWSTR asctime);
HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
- LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext,
+ LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext,
DWORD dwInternalFlags);
HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
- LPCWSTR lpszPassword, DWORD dwFlags, DWORD dwContext,
+ LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext,
DWORD dwInternalFlags);
BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
LPSTR INTERNET_GetResponseBuffer(void);
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen);
-BOOLAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile,
- LPCWSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext);
-BOOLAPI FTP_FtpSetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszDirectory);
-BOOLAPI FTP_FtpCreateDirectoryW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszDirectory);
-INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileW(LPWININETFTPSESSIONW lpwfs,
- LPCWSTR lpszSearchFile, LPWIN32_FIND_DATAW lpFindFileData, DWORD dwFlags, DWORD dwContext);
-BOOLAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszCurrentDirectory,
- LPDWORD lpdwCurrentDirectory);
-BOOL FTP_ConvertFileProp(LPFILEPROPERTIESW lpafp, LPWIN32_FIND_DATAW lpFindFileData);
-BOOL FTP_FtpRenameFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszSrc, LPCWSTR lpszDest);
-BOOL FTP_FtpRemoveDirectoryW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszDirectory);
-BOOL FTP_FtpDeleteFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszFileName);
-HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszFileName,
- DWORD fdwAccess, DWORD dwFlags, DWORD dwContext);
-BOOLAPI FTP_FtpGetFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszRemoteFile, LPCWSTR lpszNewFile,
- BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
- DWORD dwContext);
-
BOOLAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength,
DWORD dwContentLength, BOOL bEndRequest);
INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion,
LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes,
- DWORD dwFlags, DWORD dwContext);
+ DWORD dwFlags, DWORD_PTR dwContext);
+BOOL HTTP_FinishedReading(LPWININETHTTPREQW lpwhr);
-VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
+VOID SendAsyncCallback(LPWININETHANDLEHEADER hdr, DWORD_PTR dwContext,
DWORD dwInternetStatus, LPVOID lpvStatusInfo,
DWORD dwStatusInfoLength);
-VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD dwContext,
+VOID INTERNET_SendCallback(LPWININETHANDLEHEADER hdr, DWORD_PTR dwContext,
DWORD dwInternetStatus, LPVOID lpvStatusInfo,
DWORD dwStatusInfoLength);
int *sent /* out */);
BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
int *recvd /* out */);
+BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available);
BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPDWORD dwBuffer);
LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection);
+DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value);
extern void URLCacheContainers_CreateDefaults(void);
extern void URLCacheContainers_DeleteAll(void);